Hi,

I did not find any material about inheritance, and form embedding on cake
php sites so far.
I tried to use this:
http://bakery.cakephp.org/articles/santino83/2011/02/19/behavior_for_model_inheritance_the_missing_feature
but did not work perfectly.
Basicly I use MTI (multiple table inheritance)
I have classes ModelA extends AppModel, class ModelB extends ModelA, class
ModelC extends ModelA and class ModelD extends AppModel.
Let's say ModelA  belongsTo ModelD and ModelD hasMany ModelA of course.

Tables:
model_as(id, model_d_id, ...)
model_bs(id, ...)
model_cs(id, ...)
model_ds(id, ...)

Id fields in model_bs and model_cs are the same as in model_as. So before we
can save a ModelB entity we have to save ModelA to have common id. This is
handled more or less by that behavior mentioned above. (One bug exists
related to this.)

Is there any built in support from cake php, to support this kind of
architecture?
What I would need from the child entites point of view are:
- embedding the fields of the parent model on the child's form, now I put
them there by hand. Like ModelA.field1, ModelA.field2, etc. while form is
created eg. with $this->Form->create('ModelB')
- validation defined in ModelA, disapperad in the view of the child entity
- types of the fields of the parent class are not ok, on the parent form
they are ok, but on the a child form they aren't. Eg. booleans became simple
textfields.
- fields that are come via relationship of ModelA belongsTo property from
ModelD, has to be set by hand in the controller of ModelB
- on the update form these kind of fields (mentioned in the previous line),
are not field well, selected element has to be set by hand

I used the $uses = ('ModelA', 'ModelB') in the controller of ModelB.

So is there anybody who faces these situation or is it planned to be
supported in cake php?

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to