feature/cierres (#30)
Reservas agregar y aprobar Co-authored-by: Juan Pablo Vial <jpvialb@incoviba.cl> Reviewed-on: #30
This commit is contained in:
@ -29,6 +29,9 @@ class Datos extends Ideal\Repository
|
||||
->register('direccion_id', (new Implement\Repository\Mapper())
|
||||
->setProperty('direccion')
|
||||
->setFunction(function($data) {
|
||||
if ($data['direccion_id'] === null) {
|
||||
return null;
|
||||
}
|
||||
return $this->direccionRepository->fetchById($data['direccion_id']);
|
||||
})->setDefault(null))
|
||||
->register('telefono', (new Implement\Repository\Mapper())->setFunction(function($data) {
|
||||
@ -56,7 +59,7 @@ class Datos extends Ideal\Repository
|
||||
}
|
||||
public function save(Define\Model $model): Model\Persona\Datos
|
||||
{
|
||||
$this->saveNew([
|
||||
$model->id = $this->saveNew([
|
||||
'persona_rut', 'direccion_id', 'telefono', 'email', 'fecha_nacimiento', 'sexo', 'estado_civil',
|
||||
'nacionalidad', 'ocupacion'
|
||||
], [
|
||||
@ -113,4 +116,11 @@ class Datos extends Ideal\Repository
|
||||
}
|
||||
$this->connection->execute($query, $flattened);
|
||||
}
|
||||
|
||||
public function filterData(array $data): array
|
||||
{
|
||||
$fields = ['persona_rut', 'direccion_id', 'telefono', 'email', 'fecha_nacimiento', 'sexo', 'estado_civil',
|
||||
'nacionalidad', 'ocupacion'];
|
||||
return array_intersect_key($data, array_flip($fields));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user