precioRepository->fetchByProyecto($proyecto_id); foreach ($precios as $precio) { $precio->estados = $this->estadoPrecioRepository->fetchByPrecio($precio->id); $precio->current = $this->estadoPrecioRepository->fetchCurrentByPrecio($precio->id); } return $precios; } catch (EmptyResult $exception) { throw new Read(__CLASS__, $exception); } } /** * @param int $unidad_id * @return Model\Venta\Precio * @throws Read */ public function getVigenteByUnidad(int $unidad_id): Model\Venta\Precio { try { $precio = $this->precioRepository->fetchVigenteByUnidad($unidad_id); $precio->estados = $this->estadoPrecioRepository->fetchByPrecio($precio->id); $precio->current = $this->estadoPrecioRepository->fetchCurrentByPrecio($precio->id); return $precio; } catch (EmptyResult $exception) { throw new Read(__CLASS__, $exception); } } /** * @param int $unidad_id * @return array * @throws Read */ public function getByUnidad(int $unidad_id): array { try { $precios = $this->precioRepository->fetchByUnidad($unidad_id); foreach ($precios as $precio) { $precio->estados = $this->estadoPrecioRepository->fetchByPrecio($precio->id); $precio->current = $this->estadoPrecioRepository->fetchCurrentByPrecio($precio->id); } return $precios; } catch (EmptyResult $exception) { throw new Read(__CLASS__, $exception); } } }