setTable('credito'); } public function create(?array $data = null): Define\Model { $map = (new Implement\Repository\MapperParser()) ->register('pago', (new Implement\Repository\Mapper()) ->setFunction(function($data) { return $this->pagoService->getById($data['pago']); })); return $this->parseData(new Model\Venta\Credito(), $data, $map); } public function save(Define\Model $model): Define\Model { $model->id = $this->saveNew( ['banco', 'valor', 'fecha', 'uf', 'abonado', 'fecha_abono', 'pago'], [$model->pago->banco->id, $model->pago->valor, $model->pago->fecha->format('Y-m-d'), $model->pago->uf, null, null, $model->pago->id] ); return $model; } public function edit(Define\Model $model, array $new_data): Define\Model { return $this->update($model, ['banco', 'valor', 'fecha', 'uf', 'abonado', 'fecha_abono', 'pago'], $new_data); } }