setBasePath example

$path = $this->projectDir . \DIRECTORY_SEPARATOR . str_replace(\DIRECTORY_SEPARATOR . 'Resources', '', $path);
            }
            $pathname = $path . \DIRECTORY_SEPARATOR . 'Resources/theme.json';

            $basePath = realpath(pathinfo($pathname, \PATHINFO_DIRNAME)) ?: $pathname;

            $basePath = $this->stripProjectDir($basePath);

            $config = new StorefrontPluginConfiguration($name);

            $config->setThemeJson($data);
            $config->setBasePath($this->stripProjectDir($basePath));
            $config->setStorefrontEntryFilepath($this->getEntryFile($path));
            $config->setIsTheme(true);
            $config->setName($data['name']);
            $config->setAuthor($data['author']);

            if (\array_key_exists('style', $data) && \is_array($data['style'])) {
                $this->resolveStyleFiles($data['style']$basePath$config);
            }

            if (\array_key_exists('script', $data) && \is_array($data['script'])) {
                $fileCollection = FileCollection::createFromArray($data['script']);
                

    public function __construct(
        App $configApp,
        string $relativePath = '',
        ?string $host = null,
        ?string $scheme = null
    ) {
        $this->indexPage = $configApp->indexPage;

        $this->baseURL = $this->determineBaseURL($configApp$host$scheme);

        $this->setBasePath();

        // Fix routePath, query, fragment         [$routePath$query$fragment] = $this->parseRelativePath($relativePath);

        // Fix indexPage and routePath         $indexPageRoutePath = $this->getIndexPageRoutePath($routePath);

        // Fix the current URI         $uri = $this->baseURL . $indexPageRoutePath;

        // applyParts
'--sales-channel' => $salesChannel['id'],
            '--no-compile' => true,
        ]);
    }

    private function getPluginRegistryMock(): MockObject&StorefrontPluginRegistry
    {
        $storePluginConfiguration1 = new StorefrontPluginConfiguration('parentTheme');
        $storePluginConfiguration1->setThemeConfig([
            'any' => 'expectedConfig',
        ]);
        $storePluginConfiguration1->setBasePath('');

        $storePluginConfiguration2 = new StorefrontPluginConfiguration('childTheme');
        $storePluginConfiguration2->setThemeConfig([
            'any' => 'unexpectedConfig',
        ]);
        $storePluginConfiguration2->setBasePath('');

        $mock = $this->getMockBuilder(StorefrontPluginRegistry::class)
            ->disableOriginalConstructor()
            ->getMock();

        


        static::assertSame(['any' => 'expectedConfig']$themeFileResolverMock->themeConfig->getThemeConfig());
    }

    private function getPluginRegistryMock(): MockObject&StorefrontPluginRegistry
    {
        $storePluginConfiguration1 = new StorefrontPluginConfiguration('parentTheme');
        $storePluginConfiguration1->setThemeConfig([
            'any' => 'expectedConfig',
        ]);
        $storePluginConfiguration1->setBasePath('');

        $storePluginConfiguration2 = new StorefrontPluginConfiguration('childTheme');
        $storePluginConfiguration2->setThemeConfig([
            'any' => 'unexpectedConfig',
        ]);
        $storePluginConfiguration2->setBasePath('');

        $mock = $this->getMockBuilder(StorefrontPluginRegistry::class)
            ->disableOriginalConstructor()
            ->getMock();

        

    protected function fixActive(Shop $shop)
    {
        $shop = DetachedShop::createFromShop($shop);

        $main = $shop->getMain();
        if ($main !== null) {
            $main = DetachedShop::createFromShop($main);
            $shop->setHost($main->getHost());
            $shop->setSecure($main->getSecure());
            $shop->setBasePath($shop->getBasePath() ?: $main->getBasePath());
            $shop->setTemplate($main->getTemplate());
            $shop->setCurrencies($main->getCurrencies());
            $shop->setChildren($main->getChildren());
            $shop->setCustomerScope($main->getCustomerScope());
        }

        $shop->setBaseUrl($shop->getBaseUrl() ?: $shop->getBasePath());

        return DetachedShop::createFromShop($shop);
    }

    
$shop = $this->getShopByRequest($request);

        if (!$shop->getHost()) {
            $shop->setHost($request->getHttpHost());
        }
        if (!$shop->getBaseUrl()) {
            $preferBasePath = $this->get(Shopware_Components_Config::class)->get('preferBasePath');
            $shop->setBaseUrl($preferBasePath ? $request->getBasePath() : $request->getBaseUrl());
        }
        if (!$shop->getBasePath()) {
            $shop->setBasePath($request->getBasePath());
        }

        // Read original base path for resources         $request->getBasePath();
        $request->setBaseUrl($shop->getBaseUrl());

        // Update path info         $request->setPathInfo($this->createPathInfo($request$shop));

        $host = $request->getHeader('X_FORWARDED_HOST');
        if ($host !== null && $host === $shop->getHost()) {
            
if (empty($mailing)) {
            return null;
        }
        $repository = $this->get('models')->getRepository(Shop::class);
        $shop = $repository->getActiveById($mailing['languageID']);
        if ($shop === null) {
            throw new ModelNotFoundException(Shop::class$mailing['languageID']);
        }

        $this->Request()
            ->setHttpHost((string) $shop->getHost())
            ->setBasePath($shop->getBasePath())
            ->setBaseUrl($shop->getBasePath());

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

        Shopware()->Session()->set('sUserGroup', $mailing['customergroup']);
        $sql = 'SELECT * FROM s_core_customergroups WHERE groupkey=?';
        Shopware()->Session()->set('sUserGroupData', Shopware()->Db()->fetchRow($sql[$mailing['customergroup']]));

        Shopware()->Container()->get(RouterInterface::class)->setGlobalParam('module', 'frontend');
        Shopware()->Config()->offsetSet('DontAttachSession', true);
        Shopware()->Container()->get(ContextServiceInterface::class)->initializeShopContext();

        
Home | Imprint | This part of the site doesn't use cookies.