I'm not sure if I understand your question... with lists and sublists
etc, but I did something similar with events and sub-events. Your
"lists" table should contain something like (id, parent_id, name,
account_id).
class List extends AppModel {
var $name = 'List';
var $belongsTo = array(
'Account',
'ParentList' => array('className' => 'List', 'foreignKey' =>
'parent_id')
)
var $hasMany = array(
'ChildLists' => array('className' => 'List', 'foreignKey' =>
'parent_id')
);
var $hasAndBelongsToMany = 'Book';
}
So that is the self-referencing relationship, which will give you both
parent and child references when yo do a findAll().
AD7six is right about the findAllThreaded() method, if you want to
create a list with all of them though.
Hope that helps.
Cheers,
Adam
On Nov 29, 6:56 am, Comida411 <[EMAIL PROTECTED]> wrote:
> Hi
> Thank you for your response..
> The data model I presented is the logical model not the physical
> model.. The physical model is set to have the pks all id.. but its
> easier to keep track of things when modeling the logical model with
> pks using the full name...
>
> You mentioned that this might be the same as any other self
> referenceing relatinship.. I do not know if this is the same as a
> recursive relationship.. is it.. sefl referening = recursive?
> Thank you
>
> On Nov 28, 2:19 pm, AD7six <[EMAIL PROTECTED]> wrote:
>
> > On Nov 28, 7:45 pm, Comida411 <[EMAIL PROTECTED]> wrote:
>
> > > My question is complicated so I made a web page detailing my
> > > questionhttp://warmeskimo.com/cakerecur/
> > > Thank you
>
> > Isn't that the same as any other self referencing relationship that
> > works in cake without anything specific? <- hint.
>
> > Probably worth looking into:
> > conventions (unless I'm misreading the schema, all your primary keys
> > contain the name of the class. Save your fingers and call them all
> > "id")
> > findAllThreaded (name the fk parent_id and it'll work automatically)
> > the tree behavior
>
> > hth,
>
> > AD
> > PS. There seems to be a trend developing in your questions...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---