Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 2.0-BETA4
-
Fix Version/s: 2.0-RC1
-
Component/s: Mapping Drivers
-
Security Level: All
-
Labels:None
-
Environment:PHP 5.3, PDO_MYSQL
Description
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:
<discriminator-column name="discr" type="string" />
<discriminator-map>
<discriminator-mapping value="page" class="Page" />
<discriminator-mapping value="article" class="Article" />
<discriminator-mapping value="review" class="Review" />
</discriminator-map>
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.
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.