searchCriteriaBuilder = $searchCriteriaBuilder; $this->cookieRepository = $cookieRepository; $this->categoryProvider = $categoryProvider; } /** * Get cookie data for render. * * @return \Plumrocket\CookieConsent\Api\Data\CookieInterface[] */ public function get(): array { if (null === $this->cookies) { $categoriesKeys = array_map(static function (CategoryInterface $category) { return $category->getKey(); }, $this->categoryProvider->get()); $this->searchCriteriaBuilder->addFilter( CookieInterface::CATEGORY_KEY, $categoriesKeys, 'in' ); $this->cookies = $this->cookieRepository->getList($this->searchCriteriaBuilder->create())->getItems(); } return $this->cookies; } }