Uploaded image for project: 'Ibexa IBX'
  1. Ibexa IBX
  2. IBX-8012

UrlAliasGenerator::getPathPrefixByRootLocationId() does not respect languages completely

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • Customer request
    • 3.3.37, 4.5.6, 4.6.2
    • None
    • None
    • Ibexa Commerce, Ibexa Content, Ibexa Experience, Ibexa Open Source
    • Yes

    Description

      Steps to reproduce (on a fresh Ibexa Experience  v4.6.2):

      • Edit folder Content Type, uncheck  'Make content available even with missing translations' and save changes
      • Add language German (DE)  with language code ger-DE
      • Add ger-DE to admin_group languages
        config/packages/ibexa_admin_ui.yaml
        ...
            system:
                admin_group:
                    ...
                    languages: [eng-GB, ger-DE]
        
      • Create Folder Content with language ger-DE (Title: "Folder ger-DE")
        (on a clean install the locationID of the newly created Content should be 71)
      • Add configuration for the ger-DE SiteAccess:
        config/packages/add_test.yaml
        ibexa:
            siteaccess:
                list:  [eng-GB,ger-DE]
            system:
                ger-DE:
                    content:
                        tree_root:
                            location_id: 71
                    languages:
                        - ger-DE
        
      • add Controller
        Controller/TestController.php
        <?php
        
        declare(strict_types=1);
        
        namespace App\Controller;
        
        use Ibexa\Contracts\Core\Repository\LocationService;
        use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
        use Symfony\Component\Routing\Annotation\Route;
        use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
        use Symfony\Component\Routing\RouterInterface;
        
        final class TestController extends AbstractController
        {
            #[Route('/test')]
            public function __invoke(RouterInterface $router, LocationService $locationService)
            {
                $location = $locationService->loadLocation(
                    71,
                    ['ger-DE'],
                );
                dump($router->generate(
                    'ibexa.url.alias',
                    [
                        'location' => $location,
                        'siteaccess' => 'ger-DE',
                    ],
                    UrlGeneratorInterface::ABSOLUTE_PATH
                ));
                exit;
            }
        }
        

      Expected:
      Dump output should be https://../ger-DE/

      Actual Result:

      NotFoundException is thrown
      NotFoundException
      Could not find 'location' with identifier '71'
      
      in vendor/ibexa/core/src/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php (line 83)
      in vendor/ibexa/core/src/lib/Persistence/Legacy/Content/Location/Gateway/ExceptionConversion.php -> getBasicNodeData (line 46)
      in vendor/ibexa/core/src/lib/Persistence/Legacy/Content/TreeHandler.php -> getBasicNodeData (line 167)
      in vendor/ibexa/core/src/lib/Persistence/Legacy/Content/Location/Handler.php -> loadLocation (line 94)
      in var/cache/dev/ContainerUx1P7Ei/Handler_6db946d.php -> load (line 29)
      in vendor/ibexa/core/src/lib/Persistence/Cache/LocationHandler.php -> load (line 72)
      in vendor/ibexa/core/src/lib/Persistence/Cache/AbstractInMemoryHandler.php -> Ibexa\Core\Persistence\Cache\{closure} (line 99)
      in vendor/ibexa/core/src/lib/Persistence/Cache/LocationHandler.php -> getCacheValue (line 79)
      in vendor/ibexa/core/src/lib/Repository/LocationService.php -> load (line 191)
      in var/cache/dev/ContainerUx1P7Ei/LocationService_770eb8d.php -> loadLocation (line 36)
      in vendor/ibexa/core/src/lib/Repository/Mapper/ContentLocationMapper/DecoratedLocationService.php -> loadLocation (line 42)
      in vendor/ibexa/core/src/contracts/Repository/Decorator/LocationServiceDecorator.php -> loadLocation (line 42)
      in vendor/ibexa/core/src/lib/Repository/SiteAccessAware/LocationService.php -> loadLocation (line 58)
      in vendor/ibexa/core/src/lib/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php -> loadLocation (line 168)
      in vendor/ibexa/core/src/lib/Repository/Permission/PermissionResolver.php :: Ibexa\Core\MVC\Symfony\Routing\Generator\{closure} (line 420)
      in vendor/ibexa/core/src/lib/Repository/Permission/CachedPermissionService.php -> sudo (line 145)
      in vendor/ibexa/core/src/lib/Repository/Repository.php -> sudo (line 341)
      in vendor/ibexa/core/src/lib/Event/Repository.php -> sudo (line 129)
      in vendor/ibexa/core/src/lib/Repository/SiteAccessAware/Repository.php -> sudo (line 105)
      in vendor/ibexa/core/src/lib/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php -> sudo (line 169)
      in vendor/ibexa/core/src/lib/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php -> loadLocation (line 125)
      in vendor/ibexa/core/src/lib/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php -> getPathPrefixByRootLocationId (line 199)
      in vendor/ibexa/core/src/lib/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php -> createPathString (line 77)
      in vendor/ibexa/core/src/lib/MVC/Symfony/Routing/Generator.php -> doGenerate (line 92)
      in vendor/ibexa/core/src/lib/MVC/Symfony/Routing/UrlAliasRouter.php -> generate (line 320)
      in vendor/symfony-cmf/routing/src/ChainRouter.php -> generate (line 248)
      

      Designs

        Attachments

          Activity

            People

              bartlomiej.wajda@ibexa.co Bartłomiej Wajda
              thorsten.reiter@ibexa.co Thorsten Reiter
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: