groupFactory = $groupFactory; $this->groupCollectionFactory = $groupCollectionFactory; } /** * {@inheritdoc} */ public function get($id) { if (isset($this->entities[$id])) { return $this->entities[$id]; } $group = $this->groupFactory->create([ 'data' => $this->getAppConfig()->get('scopes', "groups/$id", []) ]); if (null === $group->getId()) { throw new NoSuchEntityException(); } $this->entities[$id] = $group; return $group; } /** * {@inheritdoc} */ public function getList() { if (!$this->allLoaded) { $groups = $this->getAppConfig()->get('scopes', 'groups', []); foreach ($groups as $data) { $group = $this->groupFactory->create([ 'data' => $data ]); $this->entities[$group->getId()] = $group; } $this->allLoaded = true; } return $this->entities; } /** * {@inheritdoc} */ public function clean() { $this->entities = []; $this->allLoaded = false; } /** * Retrieve application config. * * @deprecated 100.1.3 * @return Config */ private function getAppConfig() { if (!$this->appConfig) { $this->appConfig = ObjectManager::getInstance()->get(Config::class); } return $this->appConfig; } }