Hello together,
I have a problem with tree behavior. To build a menu I tried the tree
behavior. For a first test I use the example from cakephp
documentation.
But if I do the example, I got allway more than one entry into the
database. My code for the test:
function insert() {
// pseudo controller code
$data = array();
$data['Menue']['name'] = 'Home';
$this->Menue->save($data);
}
The result in the table menu:
id parent_id lft rght name
1 NULL 1 2 Home
2 NULL NULL NULL Home
If add a child to id 1
function insert() {
// pseudo controller code
$data['Menue']['parent_id'] = 1;
$data['Menue']['name'] = 'test';
$this->Menue->save($data);
}
The result in the table will be this:
1 NULL 1 6 Home
2 NULL NULL NULL Home
3 1 2 3 test
4 1 NULL NULL test
5 1 4 5 test
My model is very small:
class Menue extends AppModel {
var $name = 'Menue';
var $actsAs = array('Tree');
}
I'm using cakePHP 1.2.0.7692 RC3
Have anybody a idea?
Regards Thomas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---