Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.1
-
Fix Version/s: None
-
Component/s: Nested Set
-
Labels:None
-
Environment:Linux, PostgreSQL
Description
When trying to create new root node, the following exception is thrown.
PHP Fatal error: Uncaught exception 'Doctrine_Tree_Exception' with message 'Node must have a root id set or must be persistent and have a single-valued numeric primary key in order to be created as a root node. Automatic assignment of a root id on transient/new records is no longer supported.'
This only happens when hasManyRoots is true, and table have multiple columns in primary key.
Example:
$category = new Menu();
$category->name = 'Menu Root';
$category->language_id = 1;
$category->root_id = 23;
$category->save();
$treeObject = Doctrine::getTable('Menu')->getTree();
$treeObject->createRoot($category);
and menu table is defined as follows:
$this->hasColumn('id', 'integer', 8, array(
'type' => 'integer',
'primary' => true,
'autoincrement' => true,
'length' => '8',
));
$this->hasColumn('language_id', 'integer', 8, array(
'type' => 'integer',
'primary' => true,
'length' => '8',
));
If i remove primary option from language_id column, everything works as it should.