keyPair example

$urls = $connection
            ->fetchAllAssociative(
                'SELECT LOWER(HEX(foreign_key)) as foreign_key, seo_path_info FROM seo_url WHERE route_name = :route AND foreign_key IN (:ids) AND sales_channel_id = :channel',
                [
                    'route' => TestProductSeoUrlRoute::ROUTE_NAME,
                    'ids' => Uuid::fromHexToBytesList($ids->getList(['parent', 'red', 'green'])),
                    'channel' => Uuid::fromHexToBytes($this->salesChannelId),
                ],
                ['ids' => ArrayParameterType::STRING]
            );

        $urls = FetchModeHelper::keyPair($urls);

        static::assertCount(3, $urls);
        static::assertArrayHasKey($ids->get('parent')$urls);
        static::assertArrayHasKey($ids->get('green')$urls);
        static::assertArrayHasKey($ids->get('red')$urls);

        // name = parent | number = parent         static::assertEquals('parent/parent', $urls[$ids->get('parent')]);

        // name = red | number = red         static::assertEquals('red/red', $urls[$ids->get('red')]);

        
->innerJoin(
                'language',
                LocaleDefinition::ENTITY_NAME,
                'locale',
                'locale.id = language.locale_id'
            )
            ->where('locale.code = "de-DE"')
            ->orWhere('locale.code = "en-GB"')
            ->executeQuery()
            ->fetchAllAssociative();

        return FetchModeHelper::keyPair($all);
    }

    private function fetchConfigs(): array
    {
        $all = $this->connection->createQueryBuilder()
            ->select('LOWER(HEX(user.locale_id))')
            ->addSelect('config.value')
            ->from(UserConfigDefinition::ENTITY_NAME, 'config')
            ->innerJoin(
                'config',
                UserDefinition::ENTITY_NAME,
                

    public function getUrls(SalesChannelContext $context, int $limit, ?int $offset = null): UrlResult
    {
        $products = $this->getProducts($context$limit$offset);

        if (empty($products)) {
            return new UrlResult([], null);
        }

        $keys = FetchModeHelper::keyPair($products);

        $seoUrls = $this->getSeoUrls(array_values($keys), 'frontend.detail.page', $context$this->connection);

        $seoUrls = FetchModeHelper::groupUnique($seoUrls);

        $urls = [];
        $url = new Url();

        foreach ($products as $product) {
            $lastMod = $product['updated_at'] ?: $product['created_at'];

            
if ($salesChannelId) {
            $query->andWhere('sales_channel_id = :salesChannel');
            $query->setParameter('salesChannel', Uuid::fromHexToBytes($salesChannelId));
        }

        $query->setParameter('ids', Uuid::fromHexToBytesList(array_values($ids)), ArrayParameterType::STRING);
        $query->setParameter('routeName', NavigationPageSeoUrlRoute::ROUTE_NAME);
        $query->setParameter('language', Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM));

        $urls = $query->executeQuery()->fetchAllAssociative();

        return FetchModeHelper::keyPair($urls);
    }
}

    public function getUrls(SalesChannelContext $context, int $limit, ?int $offset = null): UrlResult
    {
        $categories = $this->getCategories($context$limit$offset);

        if (empty($categories)) {
            return new UrlResult([], null);
        }
        $keys = FetchModeHelper::keyPair($categories);

        $seoUrls = $this->getSeoUrls(array_values($keys), 'frontend.navigation.page', $context$this->connection);

        $seoUrls = FetchModeHelper::groupUnique($seoUrls);

        $urls = [];
        $url = new Url();

        foreach ($categories as $category) {
            if (!isset($seoUrls[$category['id']])) {
                continue;
            }
Home | Imprint | This part of the site doesn't use cookies.