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

Error in MemoryCachingHandler when ContentType 'product' is cached before ContentTypeGroup 'product'

    XMLWordPrintable

Details

    • Ibexa Commerce, Ibexa Content, Ibexa Experience
    • Yes

    Description

      Start with Ibexa Experience v4.5.3

      • Add a Content Type having identifier product in Content Type Group content
      • Clean all caches
      • Run a command that first loads contentType product by identifier and then contentTypeGroup product by identifier:
      src/Command/TestProductTypeGroupCommand.php
      <?php
      
      namespace App\Command;
      
      use App\AppConstants;
      use Ibexa\Contracts\Core\Repository\ContentTypeService;
      use Ibexa\Contracts\Core\Repository\PermissionResolver;
      use Ibexa\Contracts\Core\Repository\UserService;
      use Psr\Log\LoggerAwareInterface;
      use Psr\Log\LoggerAwareTrait;
      use Symfony\Component\Console\Attribute\AsCommand;
      use Symfony\Component\Console\Command\Command;
      use Symfony\Component\Console\Input\InputInterface;
      use Symfony\Component\Console\Output\OutputInterface;
      
      #[AsCommand(
          name: 'app:producttest',
          description: 'Tmp testing for ibexa support',
          hidden: true
      )]
      class TestProductTypeGroupCommand extends Command implements LoggerAwareInterface
      {
          use LoggerAwareTrait;
      
          private ContentTypeService $contentTypeService;
          private PermissionResolver $permissionResolver;
          private UserService $userService;
      
          public function __construct(
              UserService $userService,
              PermissionResolver $permissionResolver,
              ContentTypeService $contentTypeService
          )
          {
              parent::__construct();
              $this->contentTypeService = $contentTypeService;
              $this->permissionResolver = $permissionResolver;
              $this->userService = $userService;
          }
      
          protected function execute(InputInterface $input, OutputInterface $output): int
          {
              $this->permissionResolver->setCurrentUserReference($this->userService->loadUserByLogin('admin'));
      
              $ctProduct = $this->contentTypeService->loadContentTypeByIdentifier('product');
              $ctgProduct = $this->contentTypeService->loadContentTypeGroupByIdentifier('product');
      
              return self::SUCCESS;
          }
      
      }
      

      php bin/console app:producttest -v : ==>

      In MemoryCachingHandler.php line 135:
      
      [TypeError]
      Ibexa\Core\Persistence\Legacy\Content\Type\MemoryCachingHandler::loadGroupByIdentifier(): Return value must be of type Ibexa\Contracts\Core\Persistence\Content\Type\Group, Ibexa\Contracts\Core\Persistence
        \Content\Type returned
      
      
      Exception trace:
        at /var/www/html/support/pf-test/vendor/ibexa/core/src/lib/Persistence/Legacy/Content/Type/MemoryCachingHandler.php:135
       Ibexa\Core\Persistence\Legacy\Content\Type\MemoryCachingHandler->loadGroupByIdentifier() at /var/www/html/support/test/var/cache/dev/ContainerHAumVN3/MemoryCachingHandler_089f627.php:65
       ContainerHAumVN3\MemoryCachingHandler_089f627->loadGroupByIdentifier() at /var/www/html/support/test/vendor/ibexa/core/src/lib/Persistence/Cache/ContentTypeHandler.php:183
       Ibexa\Core\Persistence\Cache\ContentTypeHandler->Ibexa\Core\Persistence\Cache\{closure}() at /var/www/html/support/test/vendor/ibexa/core/src/lib/Persistence/Cache/AbstractInMemoryHandler.php:99
       Ibexa\Core\Persistence\Cache\AbstractInMemoryHandler->getCacheValue() at /var/www/html/support/test/vendor/ibexa/core/src/lib/Persistence/Cache/ContentTypeHandler.php:187
       Ibexa\Core\Persistence\Cache\ContentTypeHandler->loadGroupByIdentifier() at /var/www/html/support/test/vendor/ibexa/core/src/lib/Repository/ContentTypeService.php:195
       Ibexa\Core\Repository\ContentTypeService->loadContentTypeGroupByIdentifier() at /var/www/html/support/test/var/cache/dev/ContainerHAumVN3/ContentTypeService_45340a0.php:43
       ContainerHAumVN3\ContentTypeService_45340a0->loadContentTypeGroupByIdentifier() at /var/www/html/support/test/vendor/ibexa/core/src/contracts/Repository/Decorator/ContentTypeServiceDecorator.php:50
       Ibexa\Contracts\Core\Repository\Decorator\ContentTypeServiceDecorator->loadContentTypeGroupByIdentifier() at /var/www/html/support/test/vendor/ibexa/core/src/lib/Repository/SiteAccessAware/ContentTypeService.php:64
       Ibexa\Core\Repository\SiteAccessAware\ContentTypeService->loadContentTypeGroupByIdentifier() at /var/www/html/support/test/src/Command/TestProductTypeGroupCommand.php:52
       App\Command\TestProductTypeGroupCommand->execute() at /var/www/html/support/test/vendor/symfony/console/Command/Command.php:298
       Symfony\Component\Console\Command\Command->run() at /var/www/html/support/test/vendor/symfony/console/Application.php:1058
       Symfony\Component\Console\Application->doRunCommand() at /var/www/html/support/test/vendor/symfony/framework-bundle/Console/Application.php:96
       Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/html/support/test/vendor/symfony/console/Application.php:301
       Symfony\Component\Console\Application->doRun() at /var/www/html/support/test/vendor/symfony/framework-bundle/Console/Application.php:82
       Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/support/test/vendor/symfony/console/Application.php:171
       Symfony\Component\Console\Application->run() at /var/www/html/support/test/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:54
       Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run() at /var/www/html/support/test/vendor/autoload_runtime.php:35
       require_once() at /var/www/html/support/test/bin/console:11
      

      Designs

        Attachments

          Activity

            People

              Unassigned Unassigned
              thorsten.reiter@ibexa.co Thorsten Reiter
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: