Found a couple of links suggesting using 'ORM_Tree' to handle a self-referential table:
- http://ninjapenguin.co.uk/blog/2008/09/25/kohana-orm-tip-orm-tree
- http://attic.ist.unomaha.edu/blogs/zac/2009/12/15/orm-tree-in-kohana/
However, get an error from the controller saying 'Class ORM_Tree' not found. My model is as follows:
class Model_Article extends ORM_Tree {
protected $children = "categories";
}
I am utilizing version 3.3.1 with the following in the controller:
class Controller_Category extends Controller{
//View
public function action_index(){
$categories = ORM::factory('Category')->find_all();
$view = new View('category/index');
$view->set('category', $categories);
$this->response->body($view);
}
}
Was the class removed from version 3.3.1? If so, does anyone have suggestions for handling a self-referential table as shown below:
category_id - int(11) - No
category_name - varchar(45) - No
category_description - varchar(250) - Yes - NULL
__parent_id - int(11) - Yes - NULL
Hopefully, I got that table clear enough to understand. The __parent_id has a foreign-key relationship to the category_id. The __parent_id can be null (to allow for a root or even several top-level).
Any suggestions would be greatly appreciated as I had very high hopes to utilize the tree in a project. Please forgive if this has been answered elsewhere (please understand that I did not ask until I had 'googled' and even 'yahooed').
I am extremely new to Kahona as this framework seemed to be the best fit. I had examined somewhat Cakephp but did not care for their handling of AuthAcl - seemed a bit convoluted in that you had a 'tree' with a right and left node which I felt was unnecessarily complex. However, I have as yet not gotten to the AuthAcl of Kahona and may find that such an implementation is necessary.