On Jul 11, 5:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi all... I'm still pretty new to cakephp and I'm liking it a whole
> bunch! However, I was wondering what the model representation would
> be for a relationship of tables below.
>
> Basically, I have a navigatation system that is in a tree view.
> However, I want to set it up where leaf nodes can have many different
> parents.
>
> Table 1
> =======
> id
> name
> link
>
> Join Table
> =======
> id
> table 1 id
> table 1 parent id
>
> I'm not quite sure how to set this up or if this is even correct or
> heading in the right direction. Anyone have any advice?
Hi Paul,
Having a tree that allows for each node to have more than one parent
is likely to be a bit tricky/messy and making it a habtm relationship
will probably confuse rather than help IMO. I guess/hope you are
already aware of that.
I think you will find that it is easier to implement if you consider
the following:
A node does not have a parent*
A position (choose whatever name you like for this model) belongsTo
(Parent,Node)
A position is a completely normal tree (i.e. it has a parent_id field)
The only 'complexity' then is to ensure that each position points at a
node. I'd recommend investigating the tree behavior btw.
hth,
AD
*If you want to know if/where it is referenced as a hasMany Position.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---