compiler passes non appelé
Hello,
j'ai un soucis avec le compiler passes, il n'est jamais appelé !
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
<?php
namespace AppBunle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Reference;
class UserGeoPass implements CompilerPassInterface {
public function process(ContainerBuilder $container) {
if (!$container->hasDefinition('geo.user_locator')) {
return;
}
$service_definition = $container->getDefinition('geo.user_locator');
$tagged = $container->findTaggedServiceIds('geo.geocoder');
foreach ($tagged as $id => $attrs) {
$service_definition->addMethodCall(
'addGeocoder',
[new Reference($id)]
);
}
}
} |
Code:
1 2 3 4 5 6 7 8 9
|
class DefaultController extends Controller {
public function build(ContainerBuilder $container) {
parent::build( new ContainerBuilder());
$container->addCompilerPass(new UserGeoPass());
}
... |
Normalement dans le controlleur, la fonction build est automatiquement appelé, c'est bien ça ?
parceque j'ai l'impression que build n'est pas appelé (j'ai mis un die("coucou") dedans mais il n'y va pas) et bien sur ne fait pas ce qu'il est sensé faire.
ai je zappé un truc ?