diff --git a/src/DependencyInjection/DoctrineMongoDBExtension.php b/src/DependencyInjection/DoctrineMongoDBExtension.php index 2e89d191..de9d89bf 100644 --- a/src/DependencyInjection/DoctrineMongoDBExtension.php +++ b/src/DependencyInjection/DoctrineMongoDBExtension.php @@ -16,6 +16,7 @@ use Doctrine\Common\EventSubscriber; use Doctrine\ODM\MongoDB\Configuration as ODMConfiguration; use Doctrine\ODM\MongoDB\DocumentManager; +use Doctrine\ODM\MongoDB\Mapping\Annotations\Document; use Doctrine\ODM\MongoDB\Mapping\Driver\AttributeDriver; use Doctrine\Persistence\Mapping\Driver\MappingDriverChain; use InvalidArgumentException; @@ -143,6 +144,10 @@ public function load(array $configs, ContainerBuilder $container): void ]); }); + $container->registerAttributeForAutoconfiguration(Document::class, static function (ChildDefinition $definition): void { + $definition->addTag('container.excluded'); + }); + $this->loadMessengerServices($container, $loader); $this->loadEntityValueResolverServices($container, $loader, $config);