Implemented repository mapper, and venta show
This commit is contained in:
@ -4,8 +4,8 @@ namespace Incoviba\Repository\Venta;
|
||||
use DateTimeImmutable;
|
||||
use Incoviba\Common\Define;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Common\Implement;
|
||||
use Incoviba\Model;
|
||||
use Incoviba\Repository;
|
||||
|
||||
class Pie extends Ideal\Repository
|
||||
{
|
||||
@ -17,32 +17,22 @@ class Pie extends Ideal\Repository
|
||||
|
||||
public function create(?array $data = null): Define\Model
|
||||
{
|
||||
$map = [
|
||||
'fecha' => [
|
||||
'function' => function($data) {
|
||||
return new DateTimeImmutable($data['fecha']);
|
||||
}
|
||||
],
|
||||
'valor' => [],
|
||||
'uf' => [],
|
||||
'cuotas' => [],
|
||||
'asociado' => [
|
||||
'function' => function($data) {
|
||||
$map = (new Implement\Repository\MapperParser(['valor', 'uf', 'cuotas']))
|
||||
->register('fecha', new Implement\Repository\Mapper\DateTime('fecha'))
|
||||
->register('asociado', (new Implement\Repository\Mapper())
|
||||
->setFunction(function($data) {
|
||||
if ($data['asociado'] === null or $data['asociado'] === 0) {
|
||||
return null;
|
||||
}
|
||||
return $this->fetchById($data['asociado']);
|
||||
}
|
||||
],
|
||||
'reajuste' => [
|
||||
'function' => function($data) {
|
||||
}))
|
||||
->register('reajuste', (new Implement\Repository\Mapper())
|
||||
->setFunction(function($data) {
|
||||
if ($data['reajuste'] === null or $data['reajuste'] === 0) {
|
||||
return null;
|
||||
}
|
||||
return $this->pagoRepository->fetchById($data['reajuste']);
|
||||
}
|
||||
]
|
||||
];
|
||||
}));
|
||||
return $this->parseData(new Model\Venta\Pie(), $data, $map);
|
||||
}
|
||||
public function save(Define\Model $model): Define\Model
|
||||
|
Reference in New Issue
Block a user