I have create model :
Category: <?php namespace Idoc\Models;
use Phalcon\Mvc\Model\Behavior\NestedSet as NestedSetBehavior;
class Category extends \Phalcon\Mvc\Model { public $id; public $lft; public $rgt; public $level; public $title;
public function initialize()
{
$this->addBehavior(new NestedSetBehavior(array(
'rootAttribute' => 'root',
'leftAttribute' => 'lft',
'rightAttribute' => 'rgt',
'levelAttribute' => 'level',
)));
}
}
Controller :
<?php
namespace Idoc\Modules\Backend\Controllers;
use Phalcon\Tag; use Idoc\Models\Category; use Idoc\Modules\Backend\Forms\CategoryForm;
class CategoryController extends ControllerBase {
public function initialize()
{
$this->view->setTemplateBefore('admincp');
}
public function indexAction()
{
}
/**
* Creates a User
*/
public function addAction()
{
$root = new Category();
$root->title = 'Cars';
$root->saveNode();
}
}
But why it's not save node record in data, nothing happen . I use postgresql data. Please help