FIX: Tipo Cuenta

This commit is contained in:
2024-01-10 20:32:55 -03:00
parent 68e59770fd
commit 316cc51387
2 changed files with 6 additions and 2 deletions

View File

@ -62,7 +62,11 @@ class Mapper implements Define\Repository\Mapper
}
$value = $data[$column];
if ($this->hasFunction()) {
$value = ($this->function)($data);
if ($value !== null) {
$value = ($this->function)($data);
} elseif ($this->hasDefault()) {
$value = $this->default;
}
}
$model->{$property} = $value;
return true;

View File

@ -31,7 +31,7 @@ class CentroCosto extends Ideal\Repository
->setFunction(function(array $data) {
return $this->categoriaCentroRepository->fetchById($data['categoria_id']);
}))
->register('tipo_cuenta', (new Mapper())
->register('tipo_cuenta_id', (new Mapper())
->setProperty('tipoCuenta')
->setFunction(function(array $data) {
return $this->tipoCuentaRepository->fetchById($data['tipo_cuenta_id']);