Cleanup
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
namespace Incoviba\Service\Inmobiliaria;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use Incoviba\Exception\ServiceAction\Read;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Incoviba\Common\Ideal\Service;
|
||||
use Incoviba\Common\Implement;
|
||||
@ -16,19 +17,37 @@ class Cuenta extends Service
|
||||
parent::__construct($logger);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws Read
|
||||
*/
|
||||
public function getAllActive(): array
|
||||
{
|
||||
$cuentas = array_map([$this, 'process'], $this->cuentaRepository->fetchAll());
|
||||
return array_values(array_filter($cuentas, function(Model\Inmobiliaria\Cuenta $cuenta) {
|
||||
return $cuenta->currentEstado()->active;
|
||||
}));
|
||||
try {
|
||||
$cuentas = array_map([$this, 'process'], $this->cuentaRepository->fetchAll());
|
||||
return array_values(array_filter($cuentas, function(Model\Inmobiliaria\Cuenta $cuenta) {
|
||||
return $cuenta->currentEstado()->active;
|
||||
}));
|
||||
} catch (Implement\Exception\EmptyResult $exception) {
|
||||
throw new Read(__CLASS__, $exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $inmobiliaria_rut
|
||||
* @return array
|
||||
* @throws Read
|
||||
*/
|
||||
public function getAllActiveByInmobiliaria(int $inmobiliaria_rut): array
|
||||
{
|
||||
$cuentas = array_map([$this, 'process'], $this->cuentaRepository->fetchByInmobiliaria($inmobiliaria_rut));
|
||||
return array_values(array_filter($cuentas, function(Model\Inmobiliaria\Cuenta $cuenta) {
|
||||
return $cuenta->currentEstado()->active;
|
||||
}));
|
||||
try {
|
||||
$cuentas = array_map([$this, 'process'], $this->cuentaRepository->fetchByInmobiliaria($inmobiliaria_rut));
|
||||
return array_values(array_filter($cuentas, function(Model\Inmobiliaria\Cuenta $cuenta) {
|
||||
return $cuenta->currentEstado()->active;
|
||||
}));
|
||||
} catch (Implement\Exception\EmptyResult $exception) {
|
||||
throw new Read(__CLASS__, $exception);
|
||||
}
|
||||
}
|
||||
public function add(array $data): Model\Inmobiliaria\Cuenta
|
||||
{
|
||||
|
Reference in New Issue
Block a user