Merge pull request #214 from yethee/xml_driver
Fixed typo in the XmlDriver
This commit is contained in:
commit
41a3d90a57
@ -216,7 +216,7 @@ class XmlDriver extends AbstractFileDriver
|
||||
$associationIds = array();
|
||||
foreach ($xmlRoot->id as $idElement) {
|
||||
if ((bool)$idElement['association-key'] == true) {
|
||||
$associationIds[(string)$idElement['fieldName']] = true;
|
||||
$associationIds[(string)$idElement['name']] = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,24 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest
|
||||
$this->assertEquals($expectedMap, $class->discriminatorMap);
|
||||
}
|
||||
|
||||
public function testIdentifierWithAssociationKey()
|
||||
{
|
||||
$driver = $this->_loadDriver();
|
||||
$em = $this->_getTestEntityManager();
|
||||
$factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory();
|
||||
|
||||
$em->getConfiguration()->setMetadataDriverImpl($driver);
|
||||
$factory->setEntityManager($em);
|
||||
|
||||
$class = $factory->getMetadataFor('Doctrine\Tests\Models\DDC117\DDC117Translation');
|
||||
|
||||
$this->assertEquals(array('language', 'article'), $class->identifier);
|
||||
$this->assertArrayHasKey('article', $class->associationMappings);
|
||||
|
||||
$this->assertArrayHasKey('id', $class->associationMappings['article']);
|
||||
$this->assertTrue($class->associationMappings['article']['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $xmlMappingFile
|
||||
* @dataProvider dataValidSchema
|
||||
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
|
||||
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
|
||||
|
||||
<entity name="Doctrine\Tests\Models\DDC117\DDC117Translation">
|
||||
<many-to-one field="article" target-entity="DDC117Article">
|
||||
<join-column name="article_id" referenced-column-name="article_id" />
|
||||
</many-to-one>
|
||||
|
||||
<many-to-many field="reviewedByEditors" target-entity="DDC117Editor" mapped-by="reviewingTranslations" />
|
||||
|
||||
<one-to-many field="lastTranslatedBy" target-entity="DDC117Editor" mapped-by="lastTranslation" />
|
||||
|
||||
<id name="article" association-key="true" />
|
||||
<id name="language" type="string" />
|
||||
|
||||
<field name="title" type="string" />
|
||||
</entity>
|
||||
|
||||
</doctrine-mapping>
|
Loading…
Reference in New Issue
Block a user