Implemented repository mapper, and venta show
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user