1
0
mirror of synced 2025-01-18 22:41:43 +03:00

DDC-806 - Fix xsd schema not allowing entities without id (in inheritance hierachies)

This commit is contained in:
Benjamin Eberlei 2010-09-15 21:51:44 +02:00
parent 2e3c1506fb
commit 97e572e2d8
3 changed files with 24 additions and 7 deletions

View File

@ -63,7 +63,7 @@
<xs:element name="discriminator-column" type="orm:discriminator-column" minOccurs="0"/>
<xs:element name="discriminator-map" type="orm:discriminator-map" minOccurs="0"/>
<xs:element name="lifecycle-callbacks" type="orm:lifecycle-callbacks" minOccurs="0" maxOccurs="1" />
<xs:element name="id" type="orm:id" />
<xs:element name="id" type="orm:id" minOccurs="0" maxOccurs="1" />
<xs:element name="field" type="orm:field" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="one-to-one" type="orm:one-to-one" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="one-to-many" type="orm:one-to-many" minOccurs="0" maxOccurs="unbounded" />

View File

@ -33,18 +33,27 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest
$this->assertEquals($expectedMap, $class->discriminatorMap);
}
public function testValidateXmlSchema()
/**
* @param string $xmlMappingFile
* @dataProvider dataValidSchema
*/
public function testValidateXmlSchema($xmlMappingFile)
{
$xsdSchemaFile = __DIR__ . "/../../../../../doctrine-mapping.xsd";
$dom = new \DOMDocument('UTF-8');
$dom->load(__DIR__ . "/xml/Doctrine.Tests.ORM.Mapping.CTI.dcm.xml");
$this->assertTrue($dom->schemaValidate($xsdSchemaFile));
$dom = new \DOMDocument('UTF-8');
$dom->load(__DIR__ . "/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml");
$dom->load($xmlMappingFile);
$this->assertTrue($dom->schemaValidate($xsdSchemaFile));
}
static public function dataValidSchema()
{
return array(
array(__DIR__ . "/xml/Doctrine.Tests.ORM.Mapping.CTI.dcm.xml"),
array(__DIR__ . "/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml"),
array(__DIR__ . "/xml/CatNoId.dcm.xml"),
);
}
}
class CTI

View File

@ -0,0 +1,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://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="CatNoId">
<field name="can_has_cheezburgers" type="boolean" />
</entity>
</doctrine-mapping>