/** * Get a config by id * * @param integer $id * @return ChartConfig * @throws ChartConfigServiceException */ public function getChartConfigById($id) { $configs = $this->repository->findByUsername($this->getUsername()); foreach ($configs as $config) { if ($config->getId() == $id) { return $config; } } throw new ChartConfigServiceException("No config found for given id " . $id); }
/** * Get a config by id * * @param integer $id * @return ChartConfig */ public function getChartConfigById($id) { $configs = $this->repository->findByUsername($this->getUsername()); foreach($configs as $config) { if ( $config->getId() == $id ) { return $config; } } return $configs; }