예제 #1
0
 function remover($id)
 {
     $ok = $this->db->delete('cms_permissoes', array('modulo_id' => $id));
     if ($ok) {
         $ok = parent::remover($id);
     }
     return $ok;
 }
예제 #2
0
 /**
  * Função que remove uma notícia
  * Obs.: Retorna Exception em caso de erro.
  *
  * @param integer $id - Código da notícia - cms_noticas.id
  * @return boolean de sucesso ou falha. (ou throw em caso de algum erro)
  */
 function remover($id)
 {
     // Remove categorias antigas
     if (!$this->db->delete('cms_noticias_rel_categorias', array('noticia_id' => $id))) {
         throw new Exception('Não foi possível vínculos com categorias.');
     }
     // Remove as imagens da notícia
     $imagens = $this->db->select('id')->from('cms_noticias_imagens')->where('noticia_id', $id)->get()->result_array();
     foreach ((array) $imagens as $imagem) {
         if (!$this->remover_imagem($imagem['id'])) {
             throw new Exception('Não foi possível remover a imagem ' . $imagem['id'] . '.');
         }
     }
     return parent::remover($id);
 }