Implemented repository mapper, and venta show

This commit is contained in:
Juan Pablo Vial
2023-08-08 23:53:49 -04:00
parent ef30ae67d2
commit 59825259b6
111 changed files with 2766 additions and 612 deletions

View File

@ -4,6 +4,7 @@ namespace Incoviba\Repository\Venta;
use DateTimeImmutable;
use Incoviba\Common\Ideal;
use Incoviba\Common\Define;
use Incoviba\Common\Implement;
use Incoviba\Model;
use Incoviba\Repository;
@ -17,24 +18,17 @@ class EstadoCierre extends Ideal\Repository
public function create(?array $data = null): Define\Model
{
$map = [
'cierre' => [
'function' => function($data) {
$map = (new Implement\Repository\MapperParser())
->register('cierre', (new Implement\Repository\Mapper())
->setFunction(function($data) {
return $this->cierreRepository->fetchById($data['cierre']);
}
],
'tipo' => [
'property' => 'tipoEstadoCierre',
'function' => function($data) {
}))
->register('tipo', (new Implement\Repository\Mapper())
->setProperty('tipoEstadoCierre')
->setFunction(function($data) {
return $this->tipoEstadoCierreRepository->fetchById($data['tipo']);
}
],
'fecha' => [
'function' => function($data) {
return new DateTimeImmutable($data['fecha']);
}
]
];
}))
->register('fecha', new Implement\Repository\Mapper\DateTime('fecha'));
return $this->parseData(new Model\Venta\EstadoCierre(), $data, $map);
}
public function save(Define\Model $model): Define\Model