FIX: objeto ->array

This commit is contained in:
Juan Pablo Vial
2024-04-23 15:35:51 -04:00
parent 97ab5acf3e
commit 86034a6349

View File

@ -88,7 +88,7 @@ class Nubox extends Ideal\Service
{
$redisKey = "nubox:cuentas:{$inmobiliaria_rut}";
try {
return json_decode($this->redisService->get($redisKey));
return json_decode($this->redisService->get($redisKey), JSON_OBJECT_AS_ARRAY);
} catch (Exception\EmptyRedis) {
$today = new DateTimeImmutable();
$libro = $this->getLibroMayor($inmobiliaria_rut, new DateTimeImmutable($today->format('Y-m-1')), new DateTimeImmutable($today->format('Y-m-t')));
@ -105,12 +105,12 @@ class Nubox extends Ideal\Service
{
$cuentas = $this->getCuentas($inmobiliaria_rut);
$validas = array_filter($cuentas, function($cuenta) use ($cuentaNombre) {
return strtolower($cuenta->nombre) === strtolower($cuentaNombre);
return strtolower($cuenta['nombre']) === strtolower($cuentaNombre);
});
if (count($validas) === 0) {
throw new Exception\EmptyResult('Cuenta no encontrada');
}
return array_values($validas)[0]->codigo;
return array_values($validas)[0]['codigo'];
}
public function getLibroMayor(int $inmobiliaria_rut, DateTimeInterface $from, DateTimeInterface $to): array
{