Skip to content

Commit

Permalink
fixed inconsistency between MongoDB and ORM Annotation Reader definit…
Browse files Browse the repository at this point in the history
…ion that lead to a bug in the "common" code
  • Loading branch information
beberlei authored and fabpot committed Dec 30, 2010
1 parent 46b1b5b commit 500e02d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
Expand Up @@ -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');
}
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/DoctrineBundle/Tests/ContainerTest.php
Expand Up @@ -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'));
Expand Down
Expand Up @@ -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')
));

Expand Down Expand Up @@ -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')
));

Expand Down
Expand Up @@ -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 {
Expand Down
Expand Up @@ -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'));
}
}

0 comments on commit 500e02d

Please sign in to comment.