public static function createFromDB($table, $nodeClass, $useCache = true)
 {
     if ($table instanceof Table) {
         $table_name = $table->getTableName();
     }
     $list = \ORC\DAO\Util::getTableData($table, $useCache);
     $tree = new UnSortedTree(new $nodeClass());
     foreach ($list as $row) {
         $tree->addByKey(new $nodeClass($row), $row->get('parent_id'));
     }
     return $tree;
 }
 public function getCatalogTree()
 {
     $catalogs = $this->getCatalogs();
     $root = new CatalogNode();
     $root->setDataRow($this);
     $tree = new UnSortedTree($root);
     foreach ($catalogs as $catalog) {
         $node = new CatalogNode();
         $node->setDataRow($catalog);
         $tree->addByKey($node, $catalog->get('parent_id'));
     }
     return $tree;
 }