public function deleteAction($id) { $companies = Companies::findFirst(array('id=:id:', 'bind' => array('id' => $id))); if (!$companies) { $this->flash->error("Company was not found"); return $this->forward("companies/index"); } if (!$companies->delete()) { foreach ($companies->getMessages() as $message) { $this->flash->error((string) $message); } return $this->forward("companies/search"); } else { $this->flash->success("companies was deleted"); return $this->forward("companies/index"); } }
public function deleteAction($id) { $id = $this->filter->sanitize($id, array("int")); $companies = Companies::findFirst('id="' . $id . '"'); if (!$companies) { Flash::error("companies was not found", "alert alert-error"); return $this->_forward("companies/index"); } if (!$companies->delete()) { foreach ($companies->getMessages() as $message) { Flash::error((string) $message, "alert alert-error"); } return $this->_forward("companies/search"); } else { Flash::success("companies was deleted", "alert alert-success"); return $this->_forward("companies/index"); } }