Exemplo n.º 1
0
 public function destroyAction()
 {
     $m = $this->model;
     try {
         $data = $m::getInstance()->destroy($this->getRequest()->getParam('id'), $this->getRequest()->getParams());
     } catch (Exception $e) {
         throw Ao_Error::get($e, 'API_DESTROY_UNEXPECTED');
     }
     $this->getResponse()->appendBody(json_encode(['msgs' => Ao_Alert_Messages::get(), 'data' => $data]));
 }
Exemplo n.º 2
0
 public function destroy($id)
 {
     $obj = $this->read($id);
     $this->destroyValidate($obj);
     $this->beginTransaction();
     try {
         $this->destroyLinks($obj);
     } catch (Exception $e) {
         throw Ao_Error::get($e, '<b>Falha inesperada</b> ao tentar desvincular registros relacionados.');
     }
     try {
         $this->destroyRegistry($obj);
     } catch (Exception $e) {
         $this->rollback();
         throw Ao_Error::get($e, '<b>Falha inesperada</b> ao tentar realizar a exclusão.');
     }
     $this->commit();
     return true;
 }