From 500e02d4fd123cc03f7456527a9f70cdedb2d3d5 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Thu, 30 Dec 2010 21:04:19 +0100 Subject: [PATCH] fixed inconsistency between MongoDB and ORM Annotation Reader definition that lead to a bug in the "common" code --- .../DoctrineBundle/DependencyInjection/DoctrineExtension.php | 4 ++-- src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml | 2 +- src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php | 2 +- .../DependencyInjection/AbstractDoctrineExtensionTest.php | 4 ++-- .../DependencyInjection/DoctrineMongoDBExtension.php | 2 +- .../Bundle/DoctrineMongoDBBundle/Tests/ContainerTest.php | 1 + 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php b/src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php index 18cb2c105dbc..f280c3116415 100644 --- a/src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php +++ b/src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php @@ -228,7 +228,7 @@ protected function loadOrmDefaults(array $config, ContainerBuilder $container) { // arbitrary service that is always part of the "orm" services. Its used to check if the // defaults have to applied (first time run) or ignored (second or n-th run due to imports) - if (!$container->hasDefinition('doctrine.orm.metadata_driver.annotation.reader')) { + if (!$container->hasDefinition('doctrine.orm.metadata.annotation_reader')) { $loader = new XmlFileLoader($container, __DIR__.'/../Resources/config'); $loader->load('orm.xml'); } @@ -638,7 +638,7 @@ protected function registerMappingDrivers($objectManager, $container) $mappingDriverDef->setArguments($args); } else if ($driverType == 'annotation') { $mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.' . $driverType . '_class%'), array( - new Reference($this->getObjectManagerElementName('metadata_driver.annotation.reader')), + new Reference($this->getObjectManagerElementName('metadata.annotation_reader')), array_values($driverPaths) )); } else { diff --git a/src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml b/src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml index 20160f6c51f8..78a3bc20c7b6 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml +++ b/src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml @@ -42,7 +42,7 @@ - + Doctrine\ORM\Mapping\ orm diff --git a/src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php b/src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php index c04ba4391fb0..090769104b52 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php +++ b/src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php @@ -51,7 +51,7 @@ public function testContainer() $this->assertInstanceOf('Doctrine\DBAL\Configuration', $container->get('doctrine.dbal.default_connection.configuration')); $this->assertInstanceOf('Doctrine\Common\EventManager', $container->get('doctrine.dbal.default_connection.event_manager')); $this->assertInstanceOf('Doctrine\DBAL\Connection', $container->get('doctrine.dbal.default_connection')); - $this->assertInstanceOf('Doctrine\Common\Annotations\AnnotationReader', $container->get('doctrine.orm.metadata_driver.annotation.reader')); + $this->assertInstanceOf('Doctrine\Common\Annotations\AnnotationReader', $container->get('doctrine.orm.metadata.annotation_reader')); $this->assertInstanceOf('Doctrine\ORM\Configuration', $container->get('doctrine.orm.default_configuration')); $this->assertInstanceOf('Doctrine\ORM\Mapping\Driver\DriverChain', $container->get('doctrine.orm.default_metadata_driver')); $this->assertInstanceOf('Doctrine\Common\Cache\ArrayCache', $container->get('doctrine.orm.default_metadata_cache')); diff --git a/src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php b/src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php index f3b8f1b3865f..4b84ab113941 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php +++ b/src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php @@ -532,7 +532,7 @@ public function testSingleEntityManagerMultipleMappingBundleDefinitions() $annDef = $container->getDefinition('doctrine.orm.default_annotation_metadata_driver'); $this->assertDICConstructorArguments($annDef, array( - new Reference('doctrine.orm.metadata_driver.annotation.reader'), + new Reference('doctrine.orm.metadata.annotation_reader'), array(__DIR__ . '/Fixtures/Bundles/AnnotationsBundle/Entity') )); @@ -578,7 +578,7 @@ public function testMultipleEntityManagersMappingBundleDefinitions() $annDef = $container->getDefinition('doctrine.orm.em1_annotation_metadata_driver'); $this->assertDICConstructorArguments($annDef, array( - new Reference('doctrine.orm.metadata_driver.annotation.reader'), + new Reference('doctrine.orm.metadata.annotation_reader'), array(__DIR__ . '/Fixtures/Bundles/AnnotationsBundle/Entity') )); diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php b/src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php index f4ec5674d272..8c1d4b447a6f 100644 --- a/src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php +++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php @@ -567,7 +567,7 @@ protected function registerMappingDrivers($objectManager, $container) foreach ($this->drivers as $driverType => $driverPaths) { if ($driverType == 'annotation') { $mappingDriverDef = new Definition('%'.$this->getObjetManagerElementName('metadata.' . $driverType . '_class%'), array( - new Reference($this->getObjetManagerElementName('metadata_driver.annotation.reader')), + new Reference($this->getObjetManagerElementName('metadata.annotation_reader')), array_values($driverPaths) )); } else { diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/ContainerTest.php b/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/ContainerTest.php index be36830363b1..89a72d0d469a 100644 --- a/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/ContainerTest.php +++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/ContainerTest.php @@ -54,5 +54,6 @@ public function testContainer() $this->assertInstanceOf('Doctrine\ODM\MongoDB\DocumentManager', $container->get('doctrine.odm.mongodb.default_document_manager')); $this->assertInstanceOf('Doctrine\Common\Cache\ArrayCache', $container->get('doctrine.odm.mongodb.cache')); $this->assertInstanceOf('Doctrine\ODM\MongoDB\DocumentManager', $container->get('doctrine.odm.mongodb.document_manager')); + $this->assertInstanceof('Doctrine\Common\Annotations\AnnotationReader', $container->get('doctrine.odm.mongodb.metadata.annotation_reader')); } }