Skip to content
Browse files

[DDC-1816] Verify XML <discriminator-column /> element works as expec…

…ted/documented in tests.
  • Loading branch information...
1 parent 18d4a2f commit 7b758eee573a2667fccfe72dabacf3639c960911 @beberlei beberlei committed Jul 8, 2012
View
3 tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
@@ -334,7 +334,7 @@ public function testDiscriminatorColumnDefaults()
$class = $this->createClassMetadata('Doctrine\Tests\ORM\Mapping\Animal');
$this->assertEquals(
- array('name' => 'dtype', 'type' => 'string', 'length' => 255, 'fieldName' => 'dtype'),
+ array('name' => 'discr', 'type' => 'string', 'length' => '32', 'fieldName' => 'discr', 'columnDefinition' => null),
$class->discriminatorColumn
);
}
@@ -941,6 +941,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata)
* @Entity
* @InheritanceType("SINGLE_TABLE")
* @DiscriminatorMap({"cat" = "Cat", "dog" = "Dog"})
+ * @DiscriminatorColumn(name="discr", length=32, type="string")
*/
abstract class Animal
{
View
3 tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.Animal.dcm.xml
@@ -8,9 +8,10 @@
<discriminator-mapping value="cat" class="Cat" />
<discriminator-mapping value="dog" class="Dog" />
</discriminator-map>
+ <discriminator-column name="discr" type="string" length="32" />
<id name="id" type="integer" column="id">
<generator strategy="CUSTOM" />
<custom-id-generator class="stdClass" />
</id>
</entity>
-</doctrine-mapping>
+</doctrine-mapping>
View
6 tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.Animal.dcm.yml
@@ -4,10 +4,14 @@ Doctrine\Tests\ORM\Mapping\Animal:
discriminatorMap:
cat: Cat
dog: Dog
+ discriminatorColumn:
+ type: string
+ name: discr
+ length: 32
id:
id:
type: integer
generator:
strategy: CUSTOM
customIdGenerator:
- class: stdClass
+ class: stdClass

0 comments on commit 7b758ee

Please sign in to comment.
Something went wrong with that request. Please try again.