/** * @description load node/branch * @throws Exception * @param null|string $id * @param null|string $lk * @param null|string $rk * @param null|array where some additional where clause * @return Evil_Object_Fixed_NestedSets * @author Se# * @version 0.0.2 */ public function load($id = null, $lk = null, $rk = null, $where = null) { if (null !== $id) { $this->_id = $id; } else { $select = $this->_fixed->select()->order('lk ASC'); $select = $this->_applyWhere($select, $where); return $this->_fixed->fetchAll($select); } if (empty($lk) || empty($rk)) { // get node info parent::load($id); $this->_loaded = false; $node = $this->_data; if (isset($node['lk']) && isset($node['rk'])) { $lk = $node['lk']; $rk = $node['rk']; } else { throw new Exception(' Unknown node "' . $id . '"'); } } $select = $this->_fixed->select()->where('lk>=?', $lk)->where('rk<=?', $rk)->order('lk ASC'); $this->_data = $this->_fixed->fetchAll($select); $this->_data = is_object($this->_data) ? $this->_data->toArray() : $this->_data; return $this; }