/** * @param String $title * @param String $name * @param int $pid * @param Entity_Block $block * @return int id */ public function addBlock($title, $name, $pid, $block) { $parent = $this->treeDAO->getOne($pid); $treeLeaf = new Entity_Tree(); $treeLeaf->setTitle($title); $treeLeaf->setLink($parent['link'] . '/' . $name); $treeLeaf->setName($name); $treeLeaf->setType('block'); $treeLeaf->setRightKey($parent['right_key']); $treeLeaf->setLevel($parent['level']); $treeLeaf->setPid($pid); return $this->blockDAO->add($treeLeaf, $block); }