20 lines
648 B
PHP
20 lines
648 B
PHP
![]() |
<?php
|
||
|
namespace Incoviba\Service\Ventas;
|
||
|
|
||
|
use Incoviba\Repository;
|
||
|
|
||
|
class Precio
|
||
|
{
|
||
|
public function __construct(protected Repository\Venta\Precio $precioRepository, protected Repository\Venta\EstadoPrecio $estadoPrecioRepository) {}
|
||
|
|
||
|
public function getByProyecto(int $proyecto_id): array
|
||
|
{
|
||
|
$precios = $this->precioRepository->fetchByProyecto($proyecto_id);
|
||
|
foreach ($precios as &$precio) {
|
||
|
$precio->estados = $this->estadoPrecioRepository->fetchByPrecio($precio->id);
|
||
|
$precio->current = $this->estadoPrecioRepository->fetchCurrentByPrecio($precio->id);
|
||
|
}
|
||
|
return $precios;
|
||
|
}
|
||
|
}
|