Cleanup
This commit is contained in:
@ -32,11 +32,23 @@ class Precio 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, ['unidad', 'valor'], $new_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $proyecto_id
|
||||
* @return array
|
||||
* @throws Implement\Exception\EmptyResult
|
||||
*/
|
||||
public function fetchByProyecto(int $proyecto_id): array
|
||||
{
|
||||
$query = "SELECT a.*
|
||||
@ -50,6 +62,12 @@ WHERE ptu.`proyecto` = ? AND tep.`descripcion` = 'vigente'
|
||||
ORDER BY tu.`orden`, ptu.`nombre`, `unidad`.`subtipo`, LPAD(`unidad`.`descripcion`, 4, '0')";
|
||||
return $this->fetchMany($query, [$proyecto_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $unidad_id
|
||||
* @return array
|
||||
* @throws Implement\Exception\EmptyResult
|
||||
*/
|
||||
public function fetchByUnidad(int $unidad_id): array
|
||||
{
|
||||
$query = "SELECT a.*
|
||||
@ -59,6 +77,12 @@ FROM `{$this->getTable()}` a
|
||||
WHERE `unidad` = ?";
|
||||
return $this->fetchMany($query, [$unidad_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $unidad_id
|
||||
* @return Define\Model
|
||||
* @throws Implement\Exception\EmptyResult
|
||||
*/
|
||||
public function fetchVigenteByUnidad(int $unidad_id): Define\Model
|
||||
{
|
||||
$query = "SELECT a.*
|
||||
@ -68,6 +92,13 @@ FROM `{$this->getTable()}` a
|
||||
WHERE `unidad` = ? AND tep.`descripcion` = 'vigente'";
|
||||
return $this->fetchOne($query, [$unidad_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $unidad_id
|
||||
* @param string $date_time
|
||||
* @return Define\Model
|
||||
* @throws Implement\Exception\EmptyResult
|
||||
*/
|
||||
public function fetchByUnidadAndDate(int $unidad_id, string $date_time): Define\Model
|
||||
{
|
||||
$query = "SELECT a.*
|
||||
|
Reference in New Issue
Block a user