InvalidCookieGroupItemException example


        $cookieGroupCollection = new CookieGroupCollection();

        $this->addDefaultGroups($cookieGroupCollection);

        $this->eventManager->collect(
            'CookieCollector_Collect_Cookie_Groups',
            $cookieGroupCollection
        );

        if (!$cookieGroupCollection->isValid()) {
            throw new InvalidCookieGroupItemException('Found item inside cookie group collection, which is not of type \Shopware\Bundle\CookieBundle\Structs\CookieGroupStruct');
        }

        return $cookieGroupCollection;
    }

    private function assignCookiesToGroups(CookieCollection $cookieCollection, CookieGroupCollection $cookieGroupCollection): void
    {
        /** @var CookieStruct $cookie */
        foreach ($cookieCollection as $cookie) {
            $cookieGroup = $cookieGroupCollection->getGroupByName($cookie->getGroupName());

            
Home | Imprint | This part of the site doesn't use cookies.