[Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) |
[eluser]OverZealous[/eluser]
[quote author="storkontheroof" date="1253896943"]I'm kind of running into the same problem and i think your solution doesn't work for me, because in my case i have extra tables in my database for the extended objects (e.g. guardians, students, lecturers) with their own specifics. In my case Buildings with general info and the extended objects are Appartments/Houses/Stores with each their own specific properties[/quote] Well, there have been discussions about this in the past. It depends on how many extra properties you have. If you only have a couple, it's probably easiest to just merge them into one table. If you have a lot, you could use One-to-One relationships, with the Apartment/Houses/Stores tables having a building_id column. Then you can join the data into Building. I, again, wouldn't bother with model inheritance. Just create a model for Buildings, then create one for each of the One-to-One properties. You can easily join in those extended properties when you query like this: Code: $b = new Building(); Please look at the documentation before using this method, to understand how it works. You can also wrap the include_related and get into a method to save you time: Code: // In models/Building.php Then use it like a normal get: Code: $b = new Building(); |
Welcome Guest, Not a member yet? Register Sign In |