diff --git a/ONGRElasticsearchBundle.php b/ONGRElasticsearchBundle.php index 0b077843..054104bc 100644 --- a/ONGRElasticsearchBundle.php +++ b/ONGRElasticsearchBundle.php @@ -13,6 +13,7 @@ use ONGR\ElasticsearchBundle\DependencyInjection\Compiler\ManagerPass; use ONGR\ElasticsearchBundle\DependencyInjection\Compiler\MappingPass; +use Symfony\Component\DependencyInjection\Compiler\PassConfig; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; @@ -28,7 +29,8 @@ public function build(ContainerBuilder $container) { parent::build($container); - $container->addCompilerPass(new MappingPass()); - $container->addCompilerPass(new ManagerPass()); + // MappingPass need to be behind the Symfony `DecoratorServicePass` to allow decorating the annotation reader + $container->addCompilerPass(new MappingPass(), PassConfig::TYPE_OPTIMIZE, -10); + $container->addCompilerPass(new ManagerPass(), PassConfig::TYPE_OPTIMIZE, -11); } }