Cleanup
This commit is contained in:
@ -34,7 +34,7 @@ class Broker extends Ideal\Service
|
||||
try {
|
||||
$broker = $this->brokerRepository->create($filteredData);
|
||||
$broker = $this->brokerRepository->save($broker);
|
||||
} catch (PDOException | EmptyResult $exception) {
|
||||
} catch (PDOException $exception) {
|
||||
throw new ServiceAction\Create(__CLASS__, $exception);
|
||||
}
|
||||
}
|
||||
@ -100,7 +100,7 @@ class Broker extends Ideal\Service
|
||||
}
|
||||
try {
|
||||
$this->brokerRepository->remove($broker);
|
||||
} catch (PDOException | EmptyResult $exception) {
|
||||
} catch (PDOException $exception) {
|
||||
throw new ServiceAction\Delete(__CLASS__, $exception);
|
||||
} finally {
|
||||
return $broker;
|
||||
@ -116,6 +116,13 @@ class Broker extends Ideal\Service
|
||||
|
||||
return $broker;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model\Proyecto\Broker $broker
|
||||
* @param array $data
|
||||
* @return Model\Proyecto\Broker\Data
|
||||
* @throws ServiceAction\Create
|
||||
*/
|
||||
protected function addData(Model\Proyecto\Broker $broker, array $data): Model\Proyecto\Broker\Data
|
||||
{
|
||||
$data['broker_rut'] = $broker->rut;
|
||||
@ -123,7 +130,7 @@ class Broker extends Ideal\Service
|
||||
if (isset($filteredData['representative_rut'])) {
|
||||
try {
|
||||
$this->personaService->getById($filteredData['representative_rut']);
|
||||
} catch (EmptyResult) {
|
||||
} catch (ServiceAction\Read) {
|
||||
unset($filteredData['representative_rut']);
|
||||
}
|
||||
}
|
||||
@ -134,10 +141,17 @@ class Broker extends Ideal\Service
|
||||
try {
|
||||
$brokerData = $this->dataRepository->create($filteredData);
|
||||
return $this->dataRepository->save($brokerData);
|
||||
} catch (PDOException | EmptyResult $exception) {
|
||||
} catch (PDOException $exception) {
|
||||
throw new ServiceAction\Create(__CLASS__, $exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model\Proyecto\Broker $broker
|
||||
* @param array $data
|
||||
* @return Model\Proyecto\Broker\Data
|
||||
* @throws ServiceAction\Update
|
||||
*/
|
||||
protected function editData(Model\Proyecto\Broker $broker, array $data): Model\Proyecto\Broker\Data
|
||||
{
|
||||
try {
|
||||
|
@ -73,7 +73,7 @@ class Contract extends Ideal\Service
|
||||
$state = $this->stateRepository->create(['contract_id' => $contract->id, 'date' => $date, 'type' => $type]);
|
||||
$this->stateRepository->save($state);
|
||||
return $this->process($contract);
|
||||
} catch (Implement\Exception\EmptyResult $exception) {
|
||||
} catch (PDOException $exception) {
|
||||
throw new ServiceAction\Create(__CLASS__, $exception);
|
||||
}
|
||||
}
|
||||
@ -115,7 +115,7 @@ class Contract extends Ideal\Service
|
||||
$state = $this->stateRepository->create(['contract_id' => $contract->id, 'date' => $date, 'type' => $type]);
|
||||
$this->stateRepository->save($state);
|
||||
return $this->process($contract);
|
||||
} catch (PDOException | Implement\Exception\EmptyResult $exception) {
|
||||
} catch (PDOException $exception) {
|
||||
throw new ServiceAction\Update(__CLASS__, $exception);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user