Skip to content

Conversation

jennevdmeer
Copy link
Contributor

@jennevdmeer jennevdmeer commented Feb 18, 2025

Not much more to add.

If your compiler pass is relatively small, you can add it directly in the main
bundle class. To do so, make your bundle implement the
:class:`Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface`
and place the compiler pass code inside the ``process()`` method of the main
bundle class::
// src/MyBundle/MyBundle.php
namespace App\MyBundle;
use App\DependencyInjection\Compiler\CustomPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\AbstractBundle;
class MyBundle extends AbstractBundle
{
public function process(ContainerBuilder $container): void
{

It adds the import/implements to this part.

@javiereguiluz
Copy link
Member

Good catch, thanks Jenne.

@javiereguiluz javiereguiluz merged commit d3d5a44 into symfony:6.4 Feb 19, 2025
3 checks passed
@jennevdmeer jennevdmeer deleted the patch-2 branch February 19, 2025 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants