/** * @param UrlRewrite $url * @param Category $category * @return array */ protected function generateForCustom($url, $category) { $storeId = $url->getStoreId(); $productId = $url->getEntityId(); if (isset($this->products[$productId][$storeId])) { $product = $this->products[$productId][$storeId]; $targetPath = $url->getRedirectType() ? $this->productUrlPathGenerator->getUrlPathWithSuffix($product, $storeId, $category) : $url->getTargetPath(); if ($url->getRequestPath() === $targetPath) { return []; } return [$this->urlRewriteFactory->create()->setEntityType(ProductUrlRewriteGenerator::ENTITY_TYPE)->setEntityId($productId)->setRequestPath($url->getRequestPath())->setTargetPath($targetPath)->setRedirectType($url->getRedirectType())->setStoreId($storeId)->setDescription($url->getDescription())->setIsAutogenerated(0)->setMetadata($url->getMetadata())]; } return []; }