Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions service_container/compiler_passes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ method in the extension)::
}
}

If your compiler pass is relatively small, you can make the main bundle class implements
:class:`Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface` so that
it can add itself::
If your compiler pass is relatively small, you can make the main bundle class implement
:class:`Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface` and
it will be automatically registered as a compiler pass::

// src/MyBundle/MyBundle.php
namespace App\MyBundle;
Expand All @@ -100,12 +100,6 @@ it can add itself::

class MyBundle extends AbstractBundle implements CompilerPassInterface
{

public function build(ContainerBuilder $container): void
{
$container->addCompilerPass($this);
}

public function process(ContainerBuilder $container): void
{
// in this method you can manipulate the service container:
Expand Down
Loading