btw, the need for parent_id surprises me, as the nested set model is
supposed to function with only requiring lft,rght
On 6/19/07, Jonathan Langevin <[EMAIL PROTECTED]> wrote:
>
> I'm attempting to use the Tree behavior (patched with AD7six's diff that
> he posted in trac 2 days ago).
>
> I've added parent_id, lft, rght to my table, modified the Model to enable
> the Tree behavior.
>
> Now, if I create a new item in the table (starting from scratch), it adds
> with id = 1, parent_id = 0, lft = 1, rght = 2, which is fine
> Then if I add a child to id 1, the following unexpected behavior occurs:
>
> 2 new entries are added - first has id = 0, parent_id = 1, lft = 2, rght =
> 3
> second entry has id = 3 (apparently autoincrement value), parent_id = 1,
> lft = 4, rght = 5
>
> id 1 is updated to lft = 1, rght = 6 (which is fine)
>
> -----------------
>
> What is puzzling me, is the fact that an entry is made with id = 0. Any
> subsequent entries, whether a child entry or not, has no weird behavior.
> Only the first child does this.
>
> Any ideas?
>
> Model utilization of Tree:
>
> class Content extends AppModel
> {
> var $name = 'Content';
> var $actsAs = array('Tree');
>
> var $belongsTo = array(
> 'Parent' =>
> array(
> 'className' => 'Content',
> 'foreignKey' => 'parent_id',
> 'conditions' => '',
> 'fields' => '',
> 'order' => '',
> 'counterCache' => ''
> ),
> );
> ?>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---