removePrefix example

$seoUrl->setIsCanonical(true);
            $seoUrl->setIsModified(false);
            $seoUrl->setIsDeleted(false);

            $copy = clone $seoUrl;

            $mapping = $seoUrlRoute->getMapping($entity$salesChannel);

            $copy->setError($mapping->getError());
            $pathInfo = $this->router->generate($config->getRouteName()$mapping->getInfoPathContext());
            $pathInfo = $this->removePrefix($pathInfo$basePath);

            $copy->setPathInfo($pathInfo);

            $seoPathInfo = $this->getSeoPathInfo($mapping$config);

            if ($seoPathInfo === null || $seoPathInfo === '') {
                continue;
            }

            $copy->setSeoPathInfo($seoPathInfo);
            $copy->setSalesChannelId($salesChannel->getId());

            


    /** * @param string $name */
    public function generate($name, array $parameters = []): string
    {
        $path = $this->router->generate($name$parameters, RouterInterface::ABSOLUTE_PATH);

        $request = $this->requestStack->getMainRequest();
        $basePath = $request ? $request->getBasePath() : '';
        $path = $this->removePrefix($path$basePath);

        return self::DOMAIN_PLACEHOLDER . $path . '#';
    }

    public function replace(string $content, string $host, SalesChannelContext $context): string
    {
        return Profiler::trace('seo-url-replacer', function D) use ($content$host$context) {
            $matches = [];

            if (preg_match_all('/' . self::DOMAIN_PLACEHOLDER . '[^#]*#/', $content$matches)) {
                $mapping = $this->createDefaultMapping($matches[0]);
                
public function getRouteCollection(): RouteCollection
    {
        return $this->decorated->getRouteCollection();
    }

    public function generate(string $name, array $parameters = [], int $referenceType = self::ABSOLUTE_PATH): string
    {
        $basePath = $this->getBasePath();
        if ($referenceType === self::PATH_INFO) {
            $route = $this->decorated->generate($name$parameters);

            return $this->removePrefix($route$basePath);
        }

        if (!$this->isStorefrontRoute($name)) {
            return $this->decorated->generate($name$parameters$referenceType);
        }

        $salesChannelBaseUrl = $this->getSalesChannelBaseUrl();

        // we need to insert the sales channel base url between the baseUrl and the infoPath         switch ($referenceType) {
            case self::NETWORK_PATH:
            
Home | Imprint | This part of the site doesn't use cookies.