public function excluirPerfil() { try { $id = array_key_exists('id', $_POST) ? $_POST['id'] : null; if (empty($id)) { throw new \Exception("Selecione um perfil."); } $perfil = new Perfil(); $perfil->id = $id; $this->fachada->excluirPerfil($perfil); echo new JSONResponse(true, self::MSG_OPERACAO_SUCESSO); } catch (\Exception $e) { echo new JSONResponse(false, $e->getMessage()); } }