23 lines
645 B
PHP
23 lines
645 B
PHP
![]() |
<?php
|
||
|
namespace Incoviba\Service;
|
||
|
|
||
|
use Incoviba\Repository;
|
||
|
|
||
|
class Venta
|
||
|
{
|
||
|
public function __construct(
|
||
|
protected Repository\Venta $ventaRepository,
|
||
|
protected Repository\Venta\EstadoVenta $estadoVentaRepository
|
||
|
) {}
|
||
|
|
||
|
public function getByProyecto(int $proyecto_id): array
|
||
|
{
|
||
|
$ventas = $this->ventaRepository->fetchByProyecto($proyecto_id);
|
||
|
foreach ($ventas as &$venta) {
|
||
|
$venta->estados = $this->estadoVentaRepository->fetchByVenta($venta->id);
|
||
|
$venta->currentEstado = $this->estadoVentaRepository->fetchCurrentByVenta($venta->id);
|
||
|
}
|
||
|
return $ventas;
|
||
|
}
|
||
|
}
|