diff --git a/DependencyInjection/DoctrineMongoDBExtension.php b/DependencyInjection/DoctrineMongoDBExtension.php index 494960fa..0ef62034 100644 --- a/DependencyInjection/DoctrineMongoDBExtension.php +++ b/DependencyInjection/DoctrineMongoDBExtension.php @@ -12,11 +12,14 @@ use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\ServiceRepositoryCompilerPass; use Doctrine\Bundle\MongoDBBundle\EventSubscriber\EventSubscriberInterface; use Doctrine\Bundle\MongoDBBundle\Fixture\ODMFixtureInterface; +use Doctrine\Bundle\MongoDBBundle\Mapping\Driver\XmlDriver; use Doctrine\Bundle\MongoDBBundle\Repository\ServiceDocumentRepositoryInterface; use Doctrine\Common\DataFixtures\Loader as DataFixturesLoader; use Doctrine\Common\EventSubscriber; use Doctrine\ODM\MongoDB\Configuration as ODMConfiguration; use Doctrine\ODM\MongoDB\DocumentManager; +use Doctrine\ODM\MongoDB\Mapping\Driver\AttributeDriver; +use Doctrine\Persistence\Mapping\Driver\MappingDriverChain; use InvalidArgumentException; use MongoDB\Client; use Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension; @@ -534,7 +537,12 @@ protected function getMappingResourceExtension(): string protected function getMetadataDriverClass(string $driverType): string { - return '%' . $this->getObjectManagerElementName('metadata.' . $driverType . '.class') . '%'; + return match ($driverType) { + 'driver_chain' => MappingDriverChain::class, + 'attribute' => AttributeDriver::class, + 'xml' => XmlDriver::class, + default => throw new InvalidArgumentException(sprintf('Metadata driver not supported: "%s"', $driverType)) + }; } public function getAlias(): string diff --git a/Resources/config/mongodb.php b/Resources/config/mongodb.php index 16c36cb0..2aa06a61 100644 --- a/Resources/config/mongodb.php +++ b/Resources/config/mongodb.php @@ -5,12 +5,9 @@ use Doctrine\Bundle\MongoDBBundle\Loader\SymfonyFixturesLoader; use Doctrine\Bundle\MongoDBBundle\ManagerConfigurator; use Doctrine\Bundle\MongoDBBundle\ManagerRegistry; -use Doctrine\Bundle\MongoDBBundle\Mapping\Driver\XmlDriver; use Doctrine\Bundle\MongoDBBundle\Repository\ContainerRepositoryFactory; use Doctrine\ODM\MongoDB\DocumentManager; -use Doctrine\ODM\MongoDB\Mapping\Driver\AttributeDriver; use Doctrine\ODM\MongoDB\Tools\ResolveTargetDocumentListener; -use Doctrine\Persistence\Mapping\Driver\MappingDriverChain; use ProxyManager\Proxy\GhostObjectInterface; use Symfony\Bridge\Doctrine\ContainerAwareEventManager; use Symfony\Bridge\Doctrine\Security\User\EntityUserProvider; @@ -20,19 +17,6 @@ use function Symfony\Component\DependencyInjection\Loader\Configurator\service; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->parameters() - ->set('doctrine_mongodb.odm.cache.array.class', 'Doctrine\Common\Cache\ArrayCache') - ->set('doctrine_mongodb.odm.cache.apc.class', 'Doctrine\Common\Cache\ApcCache') - ->set('doctrine_mongodb.odm.cache.apcu.class', 'Doctrine\Common\Cache\ApcuCache') - ->set('doctrine_mongodb.odm.cache.memcache.class', 'Doctrine\Common\Cache\MemcacheCache') - ->set('doctrine_mongodb.odm.cache.memcache_host', 'localhost') - ->set('doctrine_mongodb.odm.cache.memcache_port', 11211) - ->set('doctrine_mongodb.odm.cache.memcache_instance.class', 'Memcache') - ->set('doctrine_mongodb.odm.cache.xcache.class', 'Doctrine\Common\Cache\XcacheCache') - ->set('doctrine_mongodb.odm.metadata.driver_chain.class', MappingDriverChain::class) - ->set('doctrine_mongodb.odm.metadata.attribute.class', AttributeDriver::class) - ->set('doctrine_mongodb.odm.metadata.xml.class', XmlDriver::class); - $containerConfigurator->services() ->alias(DocumentManager::class, 'doctrine_mongodb.odm.document_manager') diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index 6fb6fd95..9b9c5aee 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -14,6 +14,10 @@ UPGRADE FROM 4.x to 5.0 used directly or extended. * Remove support of Annotation mapping, you should use Attributes or XML instead. +## Configuration + +Remove all `doctrine_mongodb.odm.*` parameters. + ## Fixtures * Remove `--service` option from `doctrine:mongodb:fixtures:load` command