Skip to content

Commit

Permalink
[DoctrineBridge] removed the Xml and Yaml driver as they are now part…
Browse files Browse the repository at this point in the history
… of Doctrine
  • Loading branch information
fabpot committed Oct 15, 2011
1 parent 8b4552f commit 3ca1ccb
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 497 deletions.
161 changes: 0 additions & 161 deletions src/Symfony/Bridge/Doctrine/Mapping/Driver/XmlDriver.php

This file was deleted.

161 changes: 0 additions & 161 deletions src/Symfony/Bridge/Doctrine/Mapping/Driver/YamlDriver.php

This file was deleted.

Expand Up @@ -206,7 +206,7 @@ protected function registerMappingDrivers($objectManager, ContainerBuilder $cont
}
$mappingDriverDef->setPublic(false);
if (false !== strpos($mappingDriverDef->getClass(), 'yml') || false !== strpos($mappingDriverDef->getClass(), 'xml')) {
$mappingDriverDef->addMethodCall('setNamespacePrefixes', array(array_flip($driverPaths)));
$mappingDriverDef->setArguments(array(array_flip($driverPaths)));

This comment has been minimized.

Copy link
@jmikola

jmikola Oct 24, 2011

Contributor

Per my comment below, it looks like this is the line that broke DoctrineMongoDBBundle. I think a temporary fix will be to modify that bundle's addPaths() method to flip its parameter - at least until we can decide on @stof's suggestion: #2463

This comment has been minimized.

Copy link
@fabpot

fabpot Oct 24, 2011

Author Member

I've updated everything according to the upstream implementation. There is nothing I can do about it.

This comment has been minimized.

Copy link
@stof

stof Oct 24, 2011

Member

well, there is one thing: updating DoctrineMongoDBBundle to use a constructor argument too. I'm preparing a PR.

the issue described in #2463 is here: different bundles use different implementation of the drivers and nothing forces them to always keep their API in sync as shown here

$mappingDriverDef->addMethodCall('setGlobalBasename', array('mapping'));
}

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml
Expand Up @@ -21,8 +21,8 @@
<parameter key="doctrine.orm.metadata.driver_chain.class">Doctrine\ORM\Mapping\Driver\DriverChain</parameter>
<parameter key="doctrine.orm.metadata.annotation.class">Doctrine\ORM\Mapping\Driver\AnnotationDriver</parameter>
<parameter key="doctrine.orm.metadata.annotation_reader.class">Symfony\Bridge\Doctrine\Annotations\IndexedReader</parameter>
<parameter key="doctrine.orm.metadata.xml.class">Symfony\Bridge\Doctrine\Mapping\Driver\XmlDriver</parameter>
<parameter key="doctrine.orm.metadata.yml.class">Symfony\Bridge\Doctrine\Mapping\Driver\YamlDriver</parameter>
<parameter key="doctrine.orm.metadata.xml.class">Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver</parameter>
<parameter key="doctrine.orm.metadata.yml.class">Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver</parameter>
<parameter key="doctrine.orm.metadata.php.class">Doctrine\ORM\Mapping\Driver\PHPDriver</parameter>
<parameter key="doctrine.orm.metadata.staticphp.class">Doctrine\ORM\Mapping\Driver\StaticPHPDriver</parameter>

Expand Down
Expand Up @@ -121,8 +121,8 @@ public function testDependencyInjectionConfigurationDefaults()
$this->assertEquals('Doctrine\Common\Cache\XcacheCache', $container->getParameter('doctrine.orm.cache.xcache.class'));
$this->assertEquals('Doctrine\ORM\Mapping\Driver\DriverChain', $container->getParameter('doctrine.orm.metadata.driver_chain.class'));
$this->assertEquals('Doctrine\ORM\Mapping\Driver\AnnotationDriver', $container->getParameter('doctrine.orm.metadata.annotation.class'));
$this->assertEquals('Symfony\Bridge\Doctrine\Mapping\Driver\XmlDriver', $container->getParameter('doctrine.orm.metadata.xml.class'));
$this->assertEquals('Symfony\Bridge\Doctrine\Mapping\Driver\YamlDriver', $container->getParameter('doctrine.orm.metadata.yml.class'));
$this->assertEquals('Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver', $container->getParameter('doctrine.orm.metadata.xml.class'));
$this->assertEquals('Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver', $container->getParameter('doctrine.orm.metadata.yml.class'));

$config = array(
'proxy_namespace' => 'MyProxies',
Expand Down Expand Up @@ -552,12 +552,12 @@ public function testSingleEntityManagerMultipleMappingBundleDefinitions()

$ymlDef = $container->getDefinition('doctrine.orm.default_yml_metadata_driver');
$this->assertDICConstructorArguments($ymlDef, array(
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'YamlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine')
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'YamlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine' => 'Fixtures\Bundles\YamlBundle\Entity')
));

$xmlDef = $container->getDefinition('doctrine.orm.default_xml_metadata_driver');
$this->assertDICConstructorArguments($xmlDef, array(
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'XmlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine')
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'XmlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine' => 'Fixtures\Bundles\XmlBundle')
));
}

Expand Down Expand Up @@ -601,12 +601,12 @@ public function testMultipleEntityManagersMappingBundleDefinitions()

$ymlDef = $container->getDefinition('doctrine.orm.em2_yml_metadata_driver');
$this->assertDICConstructorArguments($ymlDef, array(
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'YamlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine')
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'YamlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine' => 'Fixtures\Bundles\YamlBundle\Entity')
));

$xmlDef = $container->getDefinition('doctrine.orm.em2_xml_metadata_driver');
$this->assertDICConstructorArguments($xmlDef, array(
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'XmlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine')
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'XmlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine' => 'Fixtures\Bundles\XmlBundle')
));
}

Expand Down

4 comments on commit 3ca1ccb

@jmikola
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabpot: Is it possible that this commit may have broken the XmlDriver and YamlDriver classes in DoctrineMongoDBBundle?

After updating my symfony submodule to master (today), I noticed exceptions for missing directories being thrown in the getAllClassNames() method. During the iteration over $this->paths, the element values are being checked as a directory, but they contain namespaces. The actual path is stored as the element key.

@stof
Copy link
Member

@stof stof commented on 3ca1ccb Oct 24, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmikola this is possible. But the good fix IMO would be to update the MongoDBBundle to align the implementation with DoctrineBundle, DoctrineCouchDBBundle and DoctrinePHPCRBundle, not to revert the current change.

I wrote a far longer answer but moved it as #2463 to make the discussion easier.

@stof
Copy link
Member

@stof stof commented on 3ca1ccb Oct 24, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI, the fix for DoctrineMongoDBBundle is available here: https://github.com/symfony/DoctrineMongoDBBundle/pull/49. I'm just waiting for a MongoDB guy to merge it. I prefer not doing it myself (even if I could) as I'm not involved directly in this bundle

@beberlei
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, didnt realize that this of course brakes MongoDB since its also using the same code for mapping definitions.

Please sign in to comment.