generateList example


    protected function filterUrls($source)
    {
        $router = $this->get(RouterInterface::class);
        $baseFile = preg_quote($router->getContext()->getBaseFile(), '#');
        $regex = '#<(a|form|iframe|link|img)[^<>]*(href|src|action)="(' . $baseFile . '[^"]*)".*>#Umsi';
        if (preg_match_all($regex$source$matches) > 0) {
            $urls = array_map('htmlspecialchars_decode', $matches[3]);
            $combinedUrls = array_combine($matches[3]$router->generateList($urls));
            if (\is_array($combinedUrls)) {
                $this->urls = $combinedUrls;
            }
        }
        // Rewrite urls in rss and atom feeds         $regex = '#<(guid|link|id)>(' . $baseFile . '[^<]*)</(guid|link|id)>#Umsi';
        if (preg_match_all($regex$source$matches) > 0) {
            $urls = array_map('htmlspecialchars_decode', $matches[2]);
            $urls = array_combine($matches[2]$router->generateList($urls));
            if (!\is_array($urls)) {
                throw new RuntimeException('Arrays could not be combined');
            }
if ($limit !== null && $offset !== null) {
            $qb->setFirstResult($offset)
                ->setMaxResults($limit);
        }

        $result = $qb->execute()->fetchAll();

        if (!\count($result)) {
            return [];
        }

        return $this->router->generateList(
            array_map(
                function D$blog) {
                    return ['sViewport' => 'blog', 'sAction' => 'detail', 'sCategory' => $blog['catID'], 'blogArticle' => $blog['blogID']];
                },
                $result
            ),
            $context
        );
    }

    /** * {@inheritdoc} */
if ($limit !== null && $offset !== null) {
            $qb->setFirstResult($offset)
                ->setMaxResults($limit);
        }

        $resultArray = $qb->execute()->fetchAll();

        if (!\count($resultArray)) {
            return [];
        }

        $variantUrls = $this->router->generateList(
            array_map(
                function D$variant) {
                    $urlElements = ['controller' => 'detail', 'action' => 'index', 'sArticle' => $variant['articleID'], 'template' => 'ajax'];

                    return $urlElements;
                },
                $resultArray
            ),
            $context
        );

        
foreach ($manufacturers as &$manufacturer) {
            $manufacturer['changed'] = new DateTime($manufacturer['changed']);
            $manufacturer['urlParams'] = [
                'sViewport' => 'listing',
                'sAction' => 'manufacturer',
                'sSupplier' => $manufacturer['id'],
            ];
        }

        unset($manufacturer);

        $routes = $this->router->generateList(array_column($manufacturers, 'urlParams')$routingContext);
        $urls = [];

        for ($i = 0, $routeCount = \count($routes)$i < $routeCount; ++$i) {
            $urls[] = new Url($routes[$i]$manufacturers[$i]['changed'], 'weekly', Supplier::class$manufacturers[$i]['id']);
        }

        $this->allExported = true;

        return $urls;
    }

    
if ($limit !== null && $offset !== null) {
            $qb->setFirstResult($offset)
                ->setMaxResults($limit);
        }

        $result = $qb->execute()->fetchAll();

        if (!\count($result)) {
            return [];
        }

        return $this->router->generateList(
            array_filter(
                array_merge(
                    array_map([$this, 'createRequestParameters']$result),
                    array_map([$this, 'createXhrRequestParameters']$result)
                )
            ),
            $context
        );
    }

    /** * {@inheritdoc} */
if ($limit !== null && $offset !== null) {
            $qb->setFirstResult($offset)
                ->setMaxResults($limit);
        }

        $result = $qb->execute()->fetchAll();

        if (!\count($result)) {
            return [];
        }

        return $this->router->generateList(
            array_map(
                function D$category) use ($context) {
                    if (((int) $category['id']) === $context->getShopId()) {
                        return ['sViewport' => 'index'];
                    }
                    $viewport = (((int) $category['blog']) === 1) ? 'blog' : 'cat';

                    return ['sViewport' => $viewport, 'sCategory' => $category['id']];
                },
                $result
            ),
            
$blog['urlParams'] = [
                'sViewport' => 'blog',
                'sAction' => 'detail',
                'sCategory' => $blog['category_id'],
                'blogArticle' => $blog['id'],
            ];
        }

        unset($blog);
        $blogs = array_values($blogs);

        $routes = $this->router->generateList(array_column($blogs, 'urlParams')$routingContext);
        $urls = [];

        for ($i = 0, $routeCount = \count($routes)$i < $routeCount; ++$i) {
            $urls[] = new Url($routes[$i]$blogs[$i]['changed'], 'weekly', Blog::class$blogs[$i]['id']);
        }

        $this->allExported = true;

        return $urls;
    }

    
$campaign['changed'] = $campaign['modified'];
            $campaign['urlParams'] = [
                'sViewport' => 'campaign',
                'emotionId' => $campaign['id'],
            ];
        }
        unset($campaign);

        $campaigns = array_values($campaigns);

        $routes = $this->router->generateList(array_column($campaigns, 'urlParams')$routingContext);
        $urls = [];

        for ($i = 0, $routeCount = \count($routes)$i < $routeCount; ++$i) {
            $urls[] = new Url($routes[$i]$campaigns[$i]['changed'], 'weekly', Emotion::class$campaigns[$i]['id']);
        }

        $this->allExported = true;

        return $urls;
    }

    


    /** * {@inheritdoc} */
    public function getList(array $ids, ShopContextInterface $context)
    {
        $manufacturers = $this->manufacturerGateway->getList($ids$context);

        // fetch all manufacturer links instead of calling {url ...} smarty function which executes a query for each link         $links = $this->collectLinks($manufacturers);
        $urls = $this->router->generateList($links);
        foreach ($manufacturers as $manufacturer) {
            if (\array_key_exists($manufacturer->getId()$urls)) {
                $manufacturer->setLink((string) $urls[$manufacturer->getId()]);
            }
        }

        return $manufacturers;
    }

    /** * @param Manufacturer[] $manufacturers * * @return array<int, array{controller: string, action: string, sSupplier: int}> */
if ($limit !== null && $offset !== null) {
            $qb->setFirstResult($offset)
                ->setMaxResults($limit);
        }

        $result = $qb->execute()->fetchAll();

        if (!\count($result)) {
            return [];
        }

        return $this->router->generateList(
            array_map(
                function D$manufacturer) {
                    return ['sViewport' => 'listing', 'sAction' => 'manufacturer', 'sSupplier' => $manufacturer['id']];
                },
                $result
            ),
            $context
        );
    }

    /** * {@inheritdoc} */
$configurations = $this->configuratorService->getProductsConfigurations($products$context);
        }

        $urls = array_map(function D$product) use ($categoryId) {
            if ($categoryId !== null) {
                return $product['linkDetails'] . '&sCategory=' . (int) $categoryId;
            }

            return $product['linkDetails'];
        }$articles);

        $rewrite = $this->router->generateList($urls);

        foreach ($articles as $key => &$product) {
            if (!\array_key_exists($key$rewrite)) {
                continue;
            }
            $product['linkDetails'] = $rewrite[$key];
        }
        unset($product);

        foreach ($articles as &$product) {
            $number = $product['ordernumber'];

            

        unset($site);

        $sites = array_values($sites);

        $this->allExported = true;

        if (\count($sites) === 0) {
            return [];
        }

        $routes = $this->router->generateList(array_column($sites, 'urlParams')$routingContext);

        $urls = [];

        for ($i = 0, $routeCount = \count($routes)$i < $routeCount; ++$i) {
            $urls[] = new Url($routes[$i]$sites[$i]['changed'], 'weekly', Site::class$sites[$i]['id']);
        }

        return $urls;
    }

    /** * {@inheritdoc} */
if ($limit !== null && $offset !== null) {
            $qb->setFirstResult($offset)
                ->setMaxResults($limit);
        }

        $result = $qb->execute()->fetchAll();

        if (!\count($result)) {
            return [];
        }

        return $this->router->generateList(
            array_map(
                function D$product) {
                    return ['controller' => 'detail', 'action' => 'index', 'sArticle' => $product['articleID'], 'c' => $product['catId']];
                },
                $result
            ),
            $context
        );
    }

    /** * {@inheritdoc} */
if ($limit !== null && $offset !== null) {
            $qb->setFirstResult($offset)
                ->setMaxResults($limit);
        }

        $result = $qb->execute()->fetchAll();

        if (!\count($result)) {
            return [];
        }

        return $this->router->generateList(
            array_map(
                function D$emotion) {
                    if ($emotion['isIndex']) {
                        $controllerName = 'index';
                    } elseif ($emotion['is_landingpage']) {
                        $controllerName = 'campaign';
                    } else {
                        $controllerName = 'listing';
                    }

                    return ['module' => 'widgets', 'sViewport' => 'emotion', 'emotionId' => $emotion['id'], 'fullPath' => true, 'controllerName' => $controllerName];
                },
foreach ($this->preFilters as $preFilter) {
                $userParams = $preFilter->preFilter($userParams$contextList[$key]);
            }
        }
        unset($userParams);
        /** @var array<int, array<string, mixed>> $preFilteredList */
        $preFilteredList = $list;

        $urls = [];
        foreach ($this->generators as $route) {
            if ($route instanceof GeneratorListInterface) {
                $urls = $route->generateList($preFilteredList$context);
            } elseif ($route instanceof GeneratorInterface) {
                foreach ($preFilteredList as $key => $params) {
                    if (isset($urls[$key]) && \is_string($urls[$key])) {
                        continue;
                    }
                    $url = $route->generate($params$contextList[$key]);
                    if (!\is_string($url)) {
                        continue;
                    }
                    $urls[$key] = $url;
                }
            }
Home | Imprint | This part of the site doesn't use cookies.