mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-796: Inheritance Discriminator mapping fails when the parent class is after a subclass alphabetically #982
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Sep 9, 2010).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user gnuffo1:
If I have a class called AbstractPage, with this single table inheritance mapping linking to the folllowing classes (Page, Article, Review), then it works fine:
If however I rename the classes to the Zend framework format, within modules (Default_Model_AbstractPage, Default_Model_Page, Article_Model_Article, Article_Model_Review), then because Article is before Default, then the schema tool gets confused and throws an error - [Doctrine\DBAL\Schema\SchemaException] The table with name 'pages' already exists. Everything else is the same but the class names.
I have attached examples of this both working and nonworking with the different naming schemes. As you can see everything else is the same.
@doctrinebot commented on GitHub (Sep 10, 2010):
Comment created by @beberlei:
if yo uspecify class="page" the class has to be called Page, not Default_Model_Page. You have to change the mapping to:
You cannot re-use the mapping for different classes, it has to be bound specifically to an exisiting class.
@doctrinebot commented on GitHub (Sep 10, 2010):
Comment created by gnuffo1:
I probably wasn't being explicit enough - when I said I rename the classes I also meant that I renamed them in all of the mapping, so I've got this:
And I've also renamed the mapping files themselves from Page.dcm.xml to Default_Model_Page.dcm.xml and so on. Still doesn't work.
@doctrinebot commented on GitHub (Sep 10, 2010):
Comment created by gnuffo1:
I've found a workaround for now. Move the subclasses into another folder (I've create a subfolder called "subclasses") and then add the second line:
$driverImpl = new Doctrine\ORM\Mapping\Driver\XmlDriver(DIR . '/mappings');
$driverImpl->addPaths(array(DIR . '/mappings/subclasses'));
That way the second folder will get read after the parent classes.
@doctrinebot commented on GitHub (Nov 16, 2010):
Comment created by @beberlei:
This issue was fixed in another ticket.
@doctrinebot commented on GitHub (Nov 16, 2010):
Issue was closed with resolution "Duplicate"