Cambio en queue para que no quede pegado esperando respuesta en cli.
Chequeo de servicios externos para agregar elementos pendientes.
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Incoviba\Repository\Persona;
|
||||
|
||||
use PDOException;
|
||||
use Incoviba\Common\Define;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Common\Implement;
|
||||
@ -85,4 +86,31 @@ class Datos extends Ideal\Repository
|
||||
->where('persona_rut = ?');
|
||||
return $this->fetchOne($query, [$persona_rut]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return void
|
||||
* @throws PDOException
|
||||
*/
|
||||
public function saveMissing(array $data): void
|
||||
{
|
||||
$dataQuery = array_fill(0, count($data), ['?', '?', '?', '?', '?', '?', '?', '?', '?']);
|
||||
$query = $this->connection->getQueryBuilder()
|
||||
->insert()
|
||||
->into($this->getTable())
|
||||
->columns([
|
||||
'direccion_id', 'telefono', 'email', 'fecha_nacimiento', 'sexo', 'estado_civil',
|
||||
'nacionalidad', 'ocupacion'
|
||||
])
|
||||
->values($dataQuery);
|
||||
$flattened = [];
|
||||
foreach ($data as $col => $value) {
|
||||
$row = [
|
||||
$value['direccion_id'] ?? null, $value['telefono'] ?? null, $value['email'] ?? null, $value['fecha_nacimiento'] ?? null,
|
||||
$value['sexo'] ?? null, $value['estado_civil'] ?? null, $value['nacionalidad'] ?? null, $value['ocupacion'] ?? null
|
||||
];
|
||||
$flattened = array_merge($flattened, $row);
|
||||
}
|
||||
$this->connection->execute($query, $flattened);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user