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