/** * constructor, creates tree with reference to table and sets default root options * * @param object $table instance of Doctrine_Table * @param array $options options */ public function __construct(Doctrine_Table $table, $options) { // set default many root attributes $options['hasManyRoots'] = isset($options['hasManyRoots']) ? $options['hasManyRoots'] : false; if ($options['hasManyRoots']) { $options['rootColumnName'] = isset($options['rootColumnName']) ? $options['rootColumnName'] : 'root_id'; } parent::__construct($table, $options); }
/** * getTree * * getter for associated tree * * @return mixed if tree return instance of Doctrine_Tree, otherwise returns false */ public function getTree() { if (isset($this->_options['treeImpl'])) { if (!$this->_tree) { $options = isset($this->_options['treeOptions']) ? $this->_options['treeOptions'] : array(); $this->_tree = Doctrine_Tree::factory($this, $this->_options['treeImpl'], $options); } return $this->_tree; } return false; }