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

@ -2,10 +2,11 @@
namespace Incoviba\Repository;
use Incoviba\Common\Define;
use Incoviba\Common\Ideal\Repository;
use Incoviba\Common\Ideal;
use Incoviba\Common\Implement;
use Incoviba\Model;
class Direccion extends Repository
class Direccion extends Ideal\Repository
{
public function __construct(Define\Connection $connection, protected Comuna $comunaRepository)
{
@ -15,16 +16,10 @@ class Direccion extends Repository
public function create(?array $data = null): Define\Model
{
$map = [
'calle' => [],
'numero' => [],
'extra' => [],
'comuna' => [
'function' => function($data) {
return $this->comunaRepository->fetchById($data['comuna']);
}
]
];
$map = (new Implement\Repository\MapperParser(['calle', 'numero', 'extra']))
->register('comuna', (new Implement\Repository\Mapper())->setFunction(function($data) {
return $this->comunaRepository->fetchById($data['comuna']);
}));
return $this->parseData(new Model\Direccion(), $data, $map);
}
public function save(Define\Model $model): Define\Model