function ExeDelete($area_id) { $this->Read->setArea_id($area_id); $this->Read->Execute()->find(); if (!$this->Read->Execute()->getResult()) { $this->Error = ['A Área que você tentou deletar não existe no sistema!', WS_ERROR]; $this->Result = false; } else { $WsUsers = new WsUsers(); $WsUsers->setArea_id($area_id); $WsUsers->Execute()->find(); $area = $this->Read->Execute()->getResult(); $this->Read->setThis($area); if ($WsUsers->Execute()->getResult()) { $this->Error = ["<b>{$this->Read->getArea_title()}</b> não pode ser deletado, pois esta sendo utilizado!", WS_ERROR]; $this->Result = false; } else { $this->Read->Execute()->delete(); $this->Error = ["<b>{$area->area_title}</b> foi deletado do sistema!", WS_ACCEPT]; } } }