Exemplo n.º 1
0
 public function deleteAction($id)
 {
     $model = Type::findFirst($id);
     $count = Type::count();
     if ($count == 1) {
         $this->flash->error($this->helper->at('Can not Delete the last Publication Type'));
         return;
     }
     if ($this->request->isPost()) {
         $model->delete();
         $this->redirect($this->url->get() . 'publication/type');
     }
     $this->view->model = $model;
     $this->helper->title($this->helper->at('Delete Type'));
 }