예제 #1
0
 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();
     }
 }
예제 #2
0
 public function __construct()
 {
     parent::__construct();
     $this->relationModel = RelationModel::getInstance();
     $this->companyModel = CompanyModel::getInstance();
 }
예제 #3
0
 /**
  * @return Company
  */
 public function getProvider()
 {
     return $this->companyModel->getByID($this->getItem()->provider);
 }