Example #1
0
 /**
  * @param Entity_Page $page
  * @param Entity_Tree $treeLeaf
  * @return int
  * @throws ErrorException
  */
 public function add($treeLeaf, $page)
 {
     if (!file_exists(ENGINE . '/dev')) {
         throw new ErrorException('I think it will never work =(');
     }
     $stmt = $this->DB->prepare('INSERT INTO `site_page`
                                     ()
                                     VALUES
                                     ()');
     $stmt->execute();
     $id = $this->DB->lastInsertId();
     $treeLeaf->setTypeId($id);
     $dao = new Dev_DAO_Tree();
     return $dao->addTree($treeLeaf);
 }
Example #2
0
 /**
  * @param Entity_Item $item
  * @param Entity_Tree $treeLeaf
  * @return int
  * @throws ErrorException
  */
 public function add($treeLeaf, $item)
 {
     if (!file_exists(ENGINE . '/dev')) {
         throw new ErrorException('I think it will never work =(');
     }
     $f = $item->getF();
     $stmt = $this->DB->prepare('INSERT INTO `site_item`
                                     (`item_f`)
                                     VALUES
                                     (:f)');
     $stmt->bindParam(':f', $f);
     $stmt->execute();
     $id = $this->DB->lastInsertId();
     $treeLeaf->setTypeId($id);
     $dao = new Dev_DAO_Tree();
     return $dao->addTree($treeLeaf);
 }
Example #3
0
 /**
  * @param Entity_Block $block
  * @param Entity_Tree $treeLeaf
  * @return int
  * @throws ErrorException
  */
 public function add($treeLeaf, $block)
 {
     if (!file_exists(ENGINE . '/dev')) {
         throw new ErrorException('I think it will never work =(');
     }
     $side = $block->getSide();
     $text = $block->getText();
     $is_text = $block->getIs_text();
     $stmt = $this->DB->prepare('INSERT INTO `site_block`
                                     (`block_side`,`block_text`,`block_is_text`)
                                     VALUES
                                     (:side,:text,:is_text)');
     $stmt->bindParam(':side', $side);
     $stmt->bindParam(':text', $text);
     $stmt->bindParam(':is_text', $is_text);
     $stmt->execute();
     $id = $this->DB->lastInsertId();
     $treeLeaf->setTypeId($id);
     $dao = new Dev_DAO_Tree();
     return $dao->addTree($treeLeaf);
 }