dataSources = $dataSources; } /** * @param mixed $key * The key declared by the data source service. * @param mixed $queryString * @param int $page * @throws \Exception * * @return array */ public function getSuggestions($key, $queryString, $page = 1) { if (!isset($this->dataSources[$key])) { throw new \Exception('No data source found for the given key.'); } return $this->dataSources[$key]->getSuggestions($queryString, $page); } /** * @param mixed $key * The key declared by the data source service. * @param array $ids * @return array * @throws \Exception */ public function getLabels($key, array $ids) { if (!isset($this->dataSources[$key])) { throw new \Exception('No data source found for the given key.'); } return $this->dataSources[$key]->getLabels($ids); } }