Files
oficial/app/src/Service/Venta.php

23 lines
645 B
PHP
Raw Normal View History

2023-07-28 16:22:20 -04:00
<?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;
}
}