Skip to content

Commit

Permalink
DDC-628 - Fix missing precision and scale attributes on doctrine-mapp…
Browse files Browse the repository at this point in the history
…ing.xsd
  • Loading branch information
beberlei committed Jun 13, 2010
1 parent af76c5f commit f2aacf4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
4 changes: 3 additions & 1 deletion doctrine-mapping.xsd
Expand Up @@ -124,6 +124,8 @@
<xs:attribute name="nullable" type="xs:boolean" default="false" />
<xs:attribute name="version" type="xs:boolean" />
<xs:attribute name="column-definition" type="xs:string" />
<xs:attribute name="precision" type="xs:integer" use="optional" />
<xs:attribute name="scale" type="xs:integer" use="optional" />
</xs:complexType>

<xs:complexType name="discriminator-column">
Expand All @@ -135,7 +137,7 @@

<xs:complexType name="unique-constraint">
<xs:attribute name="name" type="xs:NMTOKEN" use="optional"/>
<xs:attribute name="columns" type="xs:NMTOKENS" use="required"/>
<xs:attribute name="columns" type="xs:string" use="required"/>
</xs:complexType>

<xs:complexType name="unique-constraints">
Expand Down
13 changes: 13 additions & 0 deletions tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php
Expand Up @@ -32,6 +32,19 @@ public function testClassTableInheritanceDiscriminatorMap()
$this->assertEquals(3, count($class->discriminatorMap));
$this->assertEquals($expectedMap, $class->discriminatorMap);
}

public function testValidateXmlSchema()
{
$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");
$this->assertTrue($dom->schemaValidate($xsdSchemaFile));
}
}

class CTI
Expand Down
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
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\ORM\Mapping\CTI">
<discriminator-column name="discr" type="string" length=""/>
<discriminator-column name="discr" type="string" length="60"/>
<discriminator-map>
<discriminator-mapping value="foo" class="CTIFoo"/>
<discriminator-mapping value="bar" class="CTIBar"/>
Expand Down
Expand Up @@ -18,8 +18,8 @@
</lifecycle-callbacks>

<id name="id" type="integer" column="id">
<sequence-generator sequence-name="tablename_seq" allocation-size="100" initial-value="1" />
<generator strategy="AUTO"/>
<sequence-generator sequence-name="tablename_seq" allocation-size="100" initial-value="1" />
</id>

<field name="name" column="name" type="string" length="50" nullable="true" unique="true" />
Expand All @@ -31,12 +31,12 @@
</one-to-one>

<one-to-many field="phonenumbers" target-entity="Phonenumber" mapped-by="user">
<order-by>
<order-by-field name="number" direction="ASC" />
</order-by>
<cascade>
<cascade-persist/>
</cascade>
<order-by>
<order-by-field name="number" direction="ASC" />
</order-by>
</one-to-many>

<many-to-many field="groups" target-entity="Group">
Expand Down

0 comments on commit f2aacf4

Please sign in to comment.