public function destroy() { $id = $this->request->get('id'); $company = $this->companyModel->getByID($id); if ($company) { if ($company->hasRelations()) { $this->server->sendConflict(HLang::get(Lang::alert_cant_delete_company__in_relation)); } $company->getItem()->delete(); $this->server->sendOK(); } else { $this->server->sendNotFound(); } }
public function __construct() { parent::__construct(); $this->relationModel = RelationModel::getInstance(); $this->companyModel = CompanyModel::getInstance(); }
/** * @return Company */ public function getProvider() { return $this->companyModel->getByID($this->getItem()->provider); }