Exemplo n.º 1
0
 public function delete($pk)
 {
     $query = "SELECT count(*) c FROM menu_link WHERE menu_id = {$pk}";
     $children = $this->db->Select($query);
     if ($children[0]['c'] > 0) {
         $this->errors['has_children'] = "В меню находится" . $children[0]['c'] . "элемента(ов) ";
         die($this->errors['has_children']);
     }
     $menu = $this->get($pk);
     if ($this->db->beginTransaction('menu')) {
         if (parent::delete($pk) == 1) {
             M_Blocks::Instance()->delete($menu['block_id']);
             if ($this->db->commit('menu')) {
                 return true;
             }
         }
         $this->db->rollBack('menu');
     }
     return false;
 }