baseSetup example

$shop = $repository->getActiveById($shopId);
            if ($shop === null) {
                throw new Exception('No valid shop id passed');
            }

            $this->get(ShopRegistrationServiceInterface::class)->registerShop($shop);
            Shopware()->Modules()->Categories()->baseId = $shop->getCategory()->getId();

            [$elementId$shopId] = $this->SeoIndex()->getCachedTime();
            $this->SeoIndex()->setCachedTime($currentTime->format('Y-m-d H:i:s')$elementId$shopId);

            $this->RewriteTable()->baseSetup();

            $limit = 10000;
            $lastId = null;
            $lastUpdateVal = '0000-00-00 00:00:00';

            do {
                $lastUpdateVal = $this->RewriteTable()->sCreateRewriteTableArticles($lastUpdateVal$limit);
                $lastId = $this->RewriteTable()->getRewriteArticleslastId();
            } while ($lastId !== null);

            $this->SeoIndex()->setCachedTime($currentTime->format('Y-m-d H:i:s')$elementId$shopId);

            
$translator = $this->getTranslation();
        $routerCampaignTemplate = Shopware()->Config()->get('routerCampaignTemplate');

        foreach ($shops as $shop) {
            $seoIndexer->registerShop($shop->getId());
            $fallbackShopId = null;
            $fallbackShop = $shop->getFallback();
            if (!empty($fallbackShop)) {
                $fallbackShopId = $fallbackShop->getId();
            }
            // Make sure a template is available             $module->baseSetup();
            $module->sCreateRewriteTableForSingleCampaign($translator$shop->getId()$fallbackShopId$emotionData$routerCampaignTemplate);
        }
    }

    private function getSeoUrlFromRouter(int $emotionId, int $shopId): ?string
    {
        $repository = Shopware()->Container()->get(ModelManager::class)->getRepository(Shop::class);
        $shop = $repository->getActiveById($shopId);
        if (empty($shop)) {
            return null;
        }
        
private function createUrls(Type $type): void
    {
        $shops = $this->getModelManager()->getRepository(Shop::class)->getActiveShopsFixed();
        $seoIndexer = $this->get('seoindex');

        $rewriteTable = $this->get('modules')->RewriteTable();

        foreach ($shops as $shop) {
            $seoIndexer->registerShop($shop->getId());

            $rewriteTable->baseSetup();
            $rewriteTable->createSingleContentTypeUrl($type);
        }
    }

    /** * @return list<array{name: string, url: string}> */
    private function getUrls(Type $type): array
    {
        $shops = $this->getModelManager()->getRepository(Shop::class)->getActiveShopsFixed();

        

    public function sCreateRewriteTable($lastUpdate)
    {
        $this->baseSetup();

        $context = $this->contextService->createShopContext(Shopware()->Shop()->getId());

        $this->sCreateRewriteTableCleanup();
        $this->sCreateRewriteTableStatic();
        $this->sCreateRewriteTableCategories();
        $this->sCreateRewriteTableBlog(null, null, $context);
        $this->sCreateRewriteTableCampaigns();
        $lastUpdate = $this->sCreateRewriteTableArticles($lastUpdate);
        $this->sCreateRewriteTableContent(null, null, $context);
        $this->createManufacturerUrls($context);
        
if ($shop === null) {
                throw new ModelNotFoundException(Shop::class$shopId);
            }

            $this->container->get(ShopRegistrationServiceInterface::class)->registerShop($shop);

            $this->modules->Categories()->baseId = $shop->getCategory()->getId();

            [$elementId$shopId] = $this->seoIndex->getCachedTime();

            $this->seoIndex->setCachedTime($currentTime->format('Y-m-d H:i:s')$elementId$shopId);
            $this->rewriteTable->baseSetup();

            $limit = 10000;
            $lastId = null;
            $lastUpdateVal = '0000-00-00 00:00:00';

            do {
                $lastUpdateVal = $this->rewriteTable->sCreateRewriteTableArticles($lastUpdateVal$limit);
                $lastId = $this->rewriteTable->getRewriteArticleslastId();
            } while ($lastId !== null);

            $this->seoIndex->setCachedTime($currentTime->format('Y-m-d H:i:s')$elementId$shopId);

            

    public function initSeoAction()
    {
        $shopId = (int) $this->Request()->getParam('shopId', 1);

        @set_time_limit(1200);

        // Create shop         $this->SeoIndex()->registerShop($shopId);

        $this->RewriteTable()->baseSetup();
        $this->RewriteTable()->sCreateRewriteTableCleanup();

        $this->View()->assign([
            'success' => true,
        ]);
    }

    /** * Assigns the amount of the seo links which to build for this shop * Bind for: Shopware_Controllers_Seo_filterCounts */
    
Home | Imprint | This part of the site doesn't use cookies.