Details
-
Type:
Task
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.2
-
Fix Version/s: None
-
Component/s: Inheritance
-
Labels:None
Description
I want to talk about the inheritance, simple type and columns_aggregation.
Here an example of parent classes and two sub-classes : http://pastebin.com/5qJKtgp1
Here the generated models classes : http://pastebin.com/j2PmT7sd
To sum up : The parent class is Show, and the sub-classes are Video and Playlist.
- A Show have a title.
- A Video have a filename.
- A Playlist have a user.
The problem that appear with the generated models, Is that the following code is working.
$playlist = Doctrine_Core::getTable ("Model_Playlist")->find (3);
$playlist->filename;
Or, the POO concept want that the filename property doesn't exist/available on a Playlist object. And Doctrine should throw an Exception ! Or, It is not the case.
The solution is to move the generated code of the sub-classes into there own classes.
Here the complete solution : http://pastebin.com/LzTG10P7
The problem with the one-to-one or many-to-many relationship is still the same.
The solution is more POO compliant.