Facturacion, se agrega PropiedadUnidad
This commit is contained in:
32
app/src/Controller/API/Ventas/PropiedadesUnidades.php
Normal file
32
app/src/Controller/API/Ventas/PropiedadesUnidades.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace Incoviba\Controller\API\Ventas;
|
||||
|
||||
use PDOException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Incoviba\Controller\API\{withJson, emptyBody};
|
||||
use Incoviba\Controller\withRedis;
|
||||
use Incoviba\Common\Implement\Exception\{EmptyResult,EmptyRedis};
|
||||
use Incoviba\Service;
|
||||
|
||||
class PropiedadesUnidades
|
||||
{
|
||||
use emptyBody, withJson, withRedis;
|
||||
|
||||
public function edit(ServerRequestInterface $request, ResponseInterface $response,
|
||||
Service\Venta\PropiedadUnidad $propiedadUnidadService, int $pu_id): ResponseInterface
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$output = [
|
||||
'propiedad_unidad_id' => $pu_id,
|
||||
'input' => $body,
|
||||
'edited' => false
|
||||
];
|
||||
try {
|
||||
$pu = $propiedadUnidadService->getById($pu_id);
|
||||
$propiedadUnidadService->edit($pu, (array) $body);
|
||||
$output['edited'] = true;
|
||||
} catch (PDOException | EmptyResult) {}
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user