feature/cierres (#25)

Varios cambios

Co-authored-by: Juan Pablo Vial <jpvialb@incoviba.cl>
Reviewed-on: #25
This commit is contained in:
2025-07-22 13:18:00 +00:00
parent ba57cad514
commit 307f2ac7d7
418 changed files with 20045 additions and 984 deletions

View File

@ -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);
}
}