Živjo,
imam Doctrine 1.2.3 in bi rad uporabil nestedSet. Izdelal sem kontroler in model.
Kolikor vem bi moral nestedSet sam skrbeti za rootid, lft, rgt in level, vendar mi vseskozi javlja napako ko želim zapisati v tabelo prvi vnos s kontrolerjem. Javi da rootid ni določen - čeprav bi ga moral nestedSet sam določiti.
Ali kdo ve v čem je problem? Mi lahko priporočite kakšen dober Doctrine forum.
Koda:
class Cattest extends Controller
{
/**
* The constructor
* @access public
* @return void
*/
public function _construct()
{
parent::Controller();
// $this->lang->load('categories');
}
public function index()
{
$category = new Category();
$category->category_id = 1;
$category->title = 'Root Category 1';
$category->alias = 'cat1';
$category->lng = 'sl';
$category->active = '1';
$category->save();
$treeObject = Doctrine_Core::getTable('Category')->getTree();
$treeObject->createRoot($category);
}
// --------------------------------------------------------------------
}
// end Category Controler
class CategoryTest extends DoctrineRecord
{
/**
* Set Doctrine 1.2.3 definition
*/
public function setTableDefinition()
{
$this->setTableName('categorytest');
$this->hasColumn('category_id', 'integer', 4);
$this->hasColumn('lng', 'string', 5);
$this->hasColumn('title', 'string', 255);
$this->hasColumn('alias', 'string', 255);
$this->hasColumn('active', 'binary');
}
public function setUp()
{
parent::setUp();
$nestedset0 = new Doctrine_Template_NestedSet(array(
'hasManyRoots' => true));
$this->actAs($nestedset0);
}
}
// end Category model