collectLinks example

return array_shift($manufacturers);
    }

    /** * {@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}> */
Home | Imprint | This part of the site doesn't use cookies.