diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml index a0611f6c..dfe45226 100644 --- a/.github/workflows/test-application.yaml +++ b/.github/workflows/test-application.yaml @@ -74,7 +74,7 @@ jobs: job-name-prefix: 'Allow to fail: ' elasticsearch-version: '7.11.1' lint: true - symfony-version: '^6.0' + symfony-version: '^7.0' elasticsearch-package-constraint: '^7.0' env: {} @@ -82,7 +82,7 @@ jobs: job-name-prefix: 'Allow to fail: ' elasticsearch-version: '7.11.1' lint: true - symfony-version: '^6.0' + symfony-version: '^7.0' elasticsearch-package-constraint: '^7.0' env: {} @@ -90,7 +90,7 @@ jobs: job-name-prefix: 'Allow to fail: ' elasticsearch-version: '7.11.1' lint: true - symfony-version: '^6.0' + symfony-version: '^7.0' elasticsearch-package-constraint: '^7.0' env: {} diff --git a/DependencyInjection/Compiler/AnnotationReaderPass.php b/DependencyInjection/Compiler/AnnotationReaderPass.php new file mode 100644 index 00000000..4fd941c0 --- /dev/null +++ b/DependencyInjection/Compiler/AnnotationReaderPass.php @@ -0,0 +1,25 @@ +hasDefinition('es.annotation_reader')) { + return; + } + + $definition = new Definition(AnnotationReader::class); + $definition->addMethodCall('addGlobalIgnoredName', ['required']); + $container->setDefinition('es.annotation_reader', $definition); + } +} diff --git a/ONGRElasticsearchBundle.php b/ONGRElasticsearchBundle.php index 0cfa4162..25b3e64c 100644 --- a/ONGRElasticsearchBundle.php +++ b/ONGRElasticsearchBundle.php @@ -11,6 +11,7 @@ namespace ONGR\ElasticsearchBundle; +use ONGR\ElasticsearchBundle\DependencyInjection\Compiler\AnnotationReaderPass; use ONGR\ElasticsearchBundle\DependencyInjection\Compiler\ManagerPass; use ONGR\ElasticsearchBundle\DependencyInjection\Compiler\MappingPass; use ONGR\ElasticsearchBundle\DependencyInjection\Compiler\RepositoryPass; @@ -32,6 +33,7 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new MappingPass()); $container->addCompilerPass(new ManagerPass()); + $container->addCompilerPass(new AnnotationReaderPass()); // The `RepositoryPass` need to be behind the Symfony `DecoratorServicePass` // to allow decorating the annotation reader $container->addCompilerPass(new RepositoryPass(), PassConfig::TYPE_OPTIMIZE, -10); diff --git a/Resources/config/services.yml b/Resources/config/services.yml index ab555e18..1ae092c3 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -23,7 +23,7 @@ services: es.annotations.cached_reader: class: 'Doctrine\Common\Annotations\CachedReader' public: true - arguments: ["@annotations.reader", "@es.cache_engine", "%kernel.debug%"] + arguments: ["@es.annotations.reader", "@es.cache_engine", "%kernel.debug%"] es.document_finder: class: 'ONGR\ElasticsearchBundle\Mapping\DocumentFinder'