Implemented repository mapper, and venta show
This commit is contained in:
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
namespace Incoviba\Repository\Venta;
|
||||
|
||||
use PDO;
|
||||
use DateTimeImmutable;
|
||||
use Incoviba\Common\Define;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Common\Implement\Exception\EmptyResult;
|
||||
use Incoviba\Common\Implement;
|
||||
use Incoviba\Model;
|
||||
use Incoviba\Repository;
|
||||
use PDO;
|
||||
|
||||
class Cierre extends Ideal\Repository
|
||||
{
|
||||
@ -21,30 +22,17 @@ class Cierre extends Ideal\Repository
|
||||
|
||||
public function create(?array $data = null): Define\Model
|
||||
{
|
||||
$map = [
|
||||
'proyecto' => [
|
||||
'function' => function($data) {
|
||||
$map = (new Implement\Repository\MapperParser(['precio']))
|
||||
->register('proyecto', (new Implement\Repository\Mapper())
|
||||
->setFunction(function($data) {
|
||||
return $this->proyectoRepository->fetchById($data['proyecto']);
|
||||
}
|
||||
],
|
||||
'precio' => [],
|
||||
'fecha' => [
|
||||
'property' => 'dateTime',
|
||||
'function' => function($data) {
|
||||
return new DateTimeImmutable($data['fecha']);
|
||||
}
|
||||
],
|
||||
'relacionado' => [
|
||||
'function' => function($data) {
|
||||
return $data['relacionado'] !== 0;
|
||||
}
|
||||
],
|
||||
'propietario' => [
|
||||
'function' => function($data) {
|
||||
}))
|
||||
->register('fecha', new Implement\Repository\Mapper\DateTime('fecha', 'dateTime'))
|
||||
->register('relacionado', new Implement\Repository\Mapper\Boolean('relacionado'))
|
||||
->register('propietario', (new Implement\Repository\Mapper())
|
||||
->setFunction(function($data) {
|
||||
return $this->propietarioRepository->fetchById($data['propietario']);
|
||||
}
|
||||
]
|
||||
];
|
||||
}));
|
||||
return $this->parseData(new Model\Venta\Cierre(), $data, $map);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user