This commit is contained in:
Juan Pablo Vial
2025-03-03 14:57:22 -03:00
parent d165440483
commit 8f16f33a1e
56 changed files with 749 additions and 105 deletions

View File

@ -30,16 +30,38 @@ class Direccion extends Ideal\Repository
);
return $model;
}
/**
* @param Define\Model $model
* @param array $new_data
* @return Define\Model
* @throws Implement\Exception\EmptyResult
*/
public function edit(Define\Model $model, array $new_data): Define\Model
{
return $this->update($model, ['calle', 'numero', 'extra', 'comuna'], $new_data);
}
/**
* @param string $calle
* @param int $numero
* @return array
* @throws Implement\Exception\EmptyResult
*/
public function fetchByCalleAndNumero(string $calle, int $numero): array
{
$query = "SELECT * FROM `{$this->getTable()}` WHERE `calle` = ? AND `numero` = ?";
return $this->fetchMany($query, [$calle, $numero]);
}
/**
* @param string $calle
* @param int $numero
* @param string $extra
* @param int $comuna_id
* @return Model\Direccion
* @throws Implement\Exception\EmptyResult
*/
public function fetchByCalleAndNumeroAndExtraAndComuna(string $calle, int $numero, string $extra, int $comuna_id): Model\Direccion
{
$query = "SELECT * FROM `{$this->getTable()}` WHERE `calle` = ? AND `numero` = ? AND `extra` = ? AND `comuna` = ?";