FIX: Banco vacio o con espacio
This commit is contained in:
@ -68,18 +68,14 @@ class Mapper implements Define\Repository\Mapper
|
||||
}
|
||||
$value = $data[$column];
|
||||
if ($this->hasFunction()) {
|
||||
if ($value !== null and $value !== '') {
|
||||
try {
|
||||
$value = ($this->function)($data);
|
||||
} catch (EmptyResult $exception) {
|
||||
if ($this->hasDefault()) {
|
||||
$value = $this->default;
|
||||
} else {
|
||||
throw $exception;
|
||||
}
|
||||
try {
|
||||
$value = ($this->function)($data);
|
||||
} catch (EmptyResult $exception) {
|
||||
if ($this->hasDefault()) {
|
||||
$value = $this->default;
|
||||
} else {
|
||||
throw $exception;
|
||||
}
|
||||
} elseif ($this->hasDefault()) {
|
||||
$value = $this->default;
|
||||
}
|
||||
}
|
||||
$model->{$property} = $value;
|
||||
|
@ -35,7 +35,7 @@ class Cuota extends Ideal\Repository
|
||||
->register('estado', new Implement\Repository\Mapper\Boolean('estado'))
|
||||
->register('banco', (new Implement\Repository\Mapper())
|
||||
->setFunction(function($data) {
|
||||
if ($data['banco'] === null or $data['banco'] === '') {
|
||||
if ($data['banco'] === null or $data['banco'] === 0 or trim($data['banco']) === '') {
|
||||
return null;
|
||||
}
|
||||
return $this->bancoRepository->fetchById($data['banco']);
|
||||
|
@ -24,7 +24,7 @@ class Pago extends Ideal\Repository
|
||||
$map = (new Implement\Repository\MapperParser(['valor', 'identificador', 'uf', 'pagador']))
|
||||
->register('banco', (new Implement\Repository\Mapper())
|
||||
->setFunction(function($data) {
|
||||
if ($data['banco'] === null or $data['banco'] === 0) {
|
||||
if ($data['banco'] === null or $data['banco'] === 0 or trim($data['banco']) === '') {
|
||||
return null;
|
||||
}
|
||||
return $this->bancoRepository->fetchById($data['banco']);
|
||||
|
Reference in New Issue
Block a user