Skip to content

[Bundles] remove docs for the annotation compilation feature #21122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions bundles/extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,40 +169,3 @@ Using Configuration to Change the Services
The Extension is also the class that handles the configuration for that
particular bundle (e.g. the configuration in ``config/packages/<bundle_alias>.yaml``).
To read more about it, see the ":doc:`/bundles/configuration`" article.

Adding Classes to Compile
-------------------------

Bundles can hint Symfony about which of their classes contain annotations so
they are compiled when generating the application cache to improve the overall
performance. Define the list of annotated classes to compile in the
``addAnnotatedClassesToCompile()`` method::

public function load(array $configs, ContainerBuilder $container): void
{
// ...

$this->addAnnotatedClassesToCompile([
// you can define the fully qualified class names...
'Acme\\BlogBundle\\Controller\\AuthorController',
// ... but glob patterns are also supported:
'Acme\\BlogBundle\\Form\\**',

// ...
]);
}

.. note::

If some class extends from other classes, all its parents are automatically
included in the list of classes to compile.

Patterns are transformed into the actual class namespaces using the classmap
generated by Composer. Therefore, before using these patterns, you must generate
the full classmap executing the ``dump-autoload`` command of Composer.

.. warning::

This technique can't be used when the classes to compile use the ``__DIR__``
or ``__FILE__`` constants, because their values will change when loading
these classes from the ``classes.php`` file.
Loading