Inheritance?
Hello. I'm trying to solve the following problem:
In my application I have to model different kinds of people, lets say engineer, architect and designer.
Most of the data is the same for the three cases but they differ in some fields.
From OO theory I think I could solve this using either inheritance or composition. The problem is I don't know how to implement neither in Cake.
Inheritance
-----------------
I couldn't find this available in Cake. Neither STI nor MTI.
Composition
-------------------
I thought a solution would be that every kind of person HAD ONE profile (stored in a profiles table). But the problem is that if I define a has_one relation I have to place the foreign key in the profiles table rather than in the specialized ones and I can't do that because the foreign keys would be duplicated (one for architect with id X, one for designer with id X and one for engineer with id X).
What could I do? I don't want to repeat the common fields in all three tables.
Thank you!
Andrés
-- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home