diff --git a/.docs/README.md b/.docs/README.md index 9272cb30f..19c160da5 100755 --- a/.docs/README.md +++ b/.docs/README.md @@ -125,6 +125,7 @@ extensions: orm.annotations: paths: [] # define paths for Entities + excludePaths: [] # these paths will be excluded ignore: [] # ignored annotations cache: Doctrine\Common\Cache\FilesystemCache cacheDir: '%tempDir%/cache/Doctrine.Annotations' diff --git a/src/DI/OrmAnnotationsExtension.php b/src/DI/OrmAnnotationsExtension.php index 3bf2393f6..d0288d834 100644 --- a/src/DI/OrmAnnotationsExtension.php +++ b/src/DI/OrmAnnotationsExtension.php @@ -22,6 +22,7 @@ class OrmAnnotationsExtension extends CompilerExtension /** @var mixed[] */ public $defaults = [ 'paths' => [], //'%appDir%' + 'excludePaths' => [], 'ignore' => [], 'cache' => FilesystemCache::class, 'cacheDir' => '%tempDir%/cache/Doctrine.Annotations', @@ -67,7 +68,8 @@ public function loadConfiguration(): void ]); $builder->addDefinition($this->prefix('annotationDriver')) - ->setClass(AnnotationDriver::class, [$this->prefix('@reader'), Helpers::expand($config['paths'], $builder->parameters)]); + ->setClass(AnnotationDriver::class, [$this->prefix('@reader'), Helpers::expand($config['paths'], $builder->parameters)]) + ->addSetup('addExcludePaths', [Helpers::expand($config['excludePaths'], $builder->parameters)]); $builder->getDefinitionByType(Configuration::class) ->addSetup('setMetadataDriverImpl', [$this->prefix('@annotationDriver')]);