Преглед на файлове

fixed inconsistency between MongoDB and ORM Annotation Reader definition that lead to a bug in the "common" code

Benjamin Eberlei преди 14 години
родител
ревизия
500e02d4fd

+ 2 - 2
src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php

@@ -228,7 +228,7 @@ class DoctrineExtension extends Extension
     {
         // 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 @@ class DoctrineExtension extends Extension
                 $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 {

+ 1 - 1
src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml

@@ -42,7 +42,7 @@
 
     <services>
         <!--- Annotation Metadata Reader Service -->
-        <service id="doctrine.orm.metadata_driver.annotation.reader" class="%doctrine.orm.metadata.annotation_reader_class%">
+        <service id="doctrine.orm.metadata.annotation_reader" class="%doctrine.orm.metadata.annotation_reader_class%">
             <call method="setAnnotationNamespaceAlias">
               <argument>Doctrine\ORM\Mapping\</argument>
               <argument>orm</argument>

+ 1 - 1
src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php

@@ -51,7 +51,7 @@ class ContainerTest extends TestCase
         $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'));

+ 2 - 2
src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php

@@ -532,7 +532,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
 
         $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 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
 
         $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')
         ));
 

+ 1 - 1
src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php

@@ -567,7 +567,7 @@ class DoctrineMongoDBExtension extends Extension
         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 {

+ 1 - 0
src/Symfony/Bundle/DoctrineMongoDBBundle/Tests/ContainerTest.php

@@ -54,5 +54,6 @@ class ContainerTest extends TestCase
         $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'));
     }
 }