The model needs a relation for me to work with this example.
If I add the following to the model it works:
<pre>
var $belongsTo = array(
'Parent' => array(
'className' => 'Category',
'foreignKey' => 'parent_id',
'conditions' => '',
'fields' => '',
'order' => '',
'counterCache' => ''),
);
</pre>
2 - bug/glitch/feature?
I just spent a lot of time troubleshooting an odd issue. Make sure your id, lft and rght columns are set to just UNSIGNED and not UNSIGNED ZEROFILL. I like to use the ZEROFILL attribute on all my integer column types that store id values but the TreeBehavior fails without any warnings or errors if the integer column values are in the format of 00000001 instead of just 1.
On Wed, Dec 2, 2009 at 7:00 PM, Dave <davidcroda@gmail.com> wrote:
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
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:
Post a Comment