Controlador

This commit is contained in:
Juan Pablo Vial
2024-11-28 14:06:12 -03:00
parent a844589d7f
commit 1d268f9a94

View File

@ -0,0 +1,27 @@
<?php
namespace Incoviba\Controller\Ventas\Abono;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Incoviba\Service;
use Incoviba\Repository;
use Incoviba\Common\Alias\View;
use Incoviba\Common\Implement\Exception\EmptyResult;
class Cuotas
{
public function __invoke(ServerRequestInterface $request, ResponseInterface $response,
Service\Venta $ventaService,
Repository\Venta\Abono\Cuota $cuotaRepository, View $view, int $venta_id): ResponseInterface
{
$venta = null;
try {
$venta = $ventaService->getById($venta_id);
} catch (EmptyResult $e) {}
$cuotas = [];
try {
$cuotas = $cuotaRepository->fetchByVenta($venta_id);
} catch (EmptyResult $e) {}
return $view->render($response, 'ventas.escrituras.abono.cuotas', compact('venta', 'cuotas'));
}
}