Throw Read
This commit is contained in:
@ -69,14 +69,35 @@ class Venta extends Service
|
|||||||
$venta = $this->ventaRepository->fetchByProyectoAndUnidad($proyecto_nombre, $unidad_descripcion);
|
$venta = $this->ventaRepository->fetchByProyectoAndUnidad($proyecto_nombre, $unidad_descripcion);
|
||||||
return $this->process($venta);
|
return $this->process($venta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $unidad
|
||||||
|
* @param string $tipo
|
||||||
|
* @return array
|
||||||
|
* @throws Read
|
||||||
|
*/
|
||||||
public function getByUnidad(string $unidad, string $tipo): array
|
public function getByUnidad(string $unidad, string $tipo): array
|
||||||
{
|
{
|
||||||
$ventas = $this->ventaRepository->fetchByUnidad($unidad, $tipo);
|
try {
|
||||||
return array_map([$this, 'process'], $ventas);
|
$ventas = $this->ventaRepository->fetchByUnidad($unidad, $tipo);
|
||||||
|
return array_map([$this, 'process'], $ventas);
|
||||||
|
} catch (Implement\Exception\EmptyResult $exception) {
|
||||||
|
throw new Read(__CLASS__, $exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $unidad_id
|
||||||
|
* @return Model\Venta
|
||||||
|
* @throws Read
|
||||||
|
*/
|
||||||
public function getByUnidadId(int $unidad_id): Model\Venta
|
public function getByUnidadId(int $unidad_id): Model\Venta
|
||||||
{
|
{
|
||||||
return $this->process($this->ventaRepository->fetchByUnidadId($unidad_id));
|
try {
|
||||||
|
return $this->process($this->ventaRepository->fetchByUnidadId($unidad_id));
|
||||||
|
} catch (Implement\Exception\EmptyResult $exception) {
|
||||||
|
throw new Read(__CLASS__, $exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public function getByPropietario(string $propietario): array
|
public function getByPropietario(string $propietario): array
|
||||||
{
|
{
|
||||||
|
@ -16,9 +16,18 @@ class Unidad
|
|||||||
protected Precio $precioService
|
protected Precio $precioService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $unidad_id
|
||||||
|
* @return Model\Venta\Unidad
|
||||||
|
* @throws Read
|
||||||
|
*/
|
||||||
public function getById(int $unidad_id): Model\Venta\Unidad
|
public function getById(int $unidad_id): Model\Venta\Unidad
|
||||||
{
|
{
|
||||||
return $this->process($this->unidadRepository->fetchById($unidad_id));
|
try {
|
||||||
|
return $this->process($this->unidadRepository->fetchById($unidad_id));
|
||||||
|
} catch (EmptyResult $exception) {
|
||||||
|
throw new Read(__CLASS__, $exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public function getByVenta(int $venta_id): array
|
public function getByVenta(int $venta_id): array
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user