Wednesday, December 2, 2009

Re: TreeBehavior fails to set lft and rght correctly

Can you paste your model?  Or at least the important parts at the top?

On Wed, Dec 2, 2009 at 6:19 PM, Martin Kirchgessner <martin.kirch@gmail.com> wrote:
Hi everyone,

I'm using TreeBehavior in a classic model, but its lft and rght fields
are not set correctly.


I tried these two save() in a controller  :

               $this->MenuItem->create();
               $this->MenuItem->save(array('MenuItem' => array(
                       'url' => '/fre',
                       'parent_id' => null,
                       'label' => 'Home',
                       'online' => 1
                       )));
               $parent_id = $this->MenuItem->id;
               debug($this->MenuItem->verify());

               $this->MenuItem->create();
               $this->MenuItem->save(array('MenuItem' => array(
                       'url' => '/fre/p/Choses',
                       'parent_id' => $parent_id,
                       'label' => 'Choses',
                       'online' => 1
                       )));

               debug($this->MenuItem->verify());

               debug($this->MenuItem->recover());

               debug($this->MenuItem->verify());

               die();

I truncated the table menu_items, ran the test and discovered that the
two last calls to verify() fail, even after recover().

I followed the cookbook... but did I miss something?

If it can helps :
I'm running Cake 1.2.3.8166
I also tried to download the last TreeBehavior from cake's master
branch, but it didn't change anything

thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en

No comments: