public function create() { $name = $this->request->get('name'); if ($this->companyModel->exists($name)) { $this->server->sendConflict(HLang::get(Lang::alert_company_exists)); } $item = new CompanyTable(); $item->name = $name; $item->insert(); $company = new Company($item); $this->server->sendData($company->toJSON()); }