TipoUnidad por Proyecto
This commit is contained in:
@ -31,6 +31,18 @@ class TipoUnidad extends Ideal\Repository
|
||||
{
|
||||
return $this->update($model, ['descripcion', 'orden'], $new_data);
|
||||
}
|
||||
|
||||
public function fetchByProyecto(int $proyecto_id): array
|
||||
{
|
||||
$query = $this->connection->getQueryBuilder()
|
||||
->select('a.*')
|
||||
->from("{$this->getTable()} a")
|
||||
->joined('JOIN proyecto_tipo_unidad b ON b.tipo = a.id')
|
||||
->where('b.proyecto = ?')
|
||||
->group('a.id')
|
||||
->order('a.orden');
|
||||
return $this->fetchMany($query, [$proyecto_id]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user