Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23610

PAPI: InactiveScopeException when updating user content

    XMLWordPrintable

    Details

      Description

      When updating a User content (using contentUpdateStruct / UserService ), an 'Symfony\Component\DependencyInjection\Exception\InactiveScopeException' is thrown with message:'You cannot create a service ("request") of an inactive scope ("request")

      Code:
              /** @var \eZ\Publish\API\Repository\Repository $repository */
              $repository = $this->getRepository();
              $userService = $repository->getUserService();
      
              $userUpdateStruct = $userService->newUserUpdateStruct();
              $userUpdateStruct->contentUpdateStruct = $repository->getContentService()->newContentUpdateStruct();
      
              foreach ( $fields as $fieldName => $fieldValue )
              {
                  $userUpdateStruct->contentUpdateStruct->setField( $fieldName, $fieldValue );
              }
      
              $repository->sudo(
                  function() use( $user, $userUpdateStruct, $userService )
                  {
                      $userService->updateUser( $user, $userUpdateStruct );
                  }
              );
      
      Stack trace:
            #0 /var/www/ezpublish-community/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php(326): ezpublishBehatDebugProjectContainer->getRequestService()
            #1 /var/www/ezpublish-community/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/MVC/Legacy/Kernel/Loader.php(152): Symfony\Component\DependencyInjection\Container->get('request')
            #2 /var/www/ezpublish-community/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/MVC/Legacy/Kernel/Loader.php(112): eZ\Publish\Core\MVC\Legacy\Kernel\Loader->eZ\Publish\Core\MVC\Legacy\Kernel\{closure}()
            #3 /var/www/ezpublish-community/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/SignalSlot/Slot/AbstractLegacySlot.php(52): eZ\Publish\Core\MVC\Legacy\Kernel\Loader->eZ\Publish\Core\MVC\Legacy\Kernel\{closure}()
            #4 /var/www/ezpublish-community/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/SignalSlot/Slot/LegacyUpdateUserSlot.php(43): eZ\Publish\Core\SignalSlot\Slot\AbstractLegacySlot->runLegacyKernelCallback(Object(Closure))
            #5 /var/www/ezpublish-community/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/SignalSlot/SignalDispatcher/DefaultSignalDispatcher.php(80): eZ\Publish\Core\SignalSlot\Slot\LegacyUpdateUserSlot->receive(Object(eZ\Publish\Core\SignalSlot\Signal\UserService\UpdateUserSignal))
            #6 /var/www/ezpublish-community/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/SignalSlot/SignalDispatcher/SignalDispatcherTransactionWrapper.php(71): eZ\Publish\Core\SignalSlot\SignalDispatcher\DefaultSignalDispatcher->emit(Object(eZ\Publish\Core\SignalSlot\Signal\UserService\UpdateUserSignal))
            #7 /var/www/ezpublish-community/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/SignalSlot/UserService.php(341): eZ\Publish\Core\SignalSlot\SignalDispatcher\SignalDispatcherTransactionWrapper->emit(Object(eZ\Publish\Core\SignalSlot\Signal\UserService\UpdateUserSignal))
            #8 ObjectManager/User.php(234): eZ\Publish\Core\SignalSlot\UserService->updateUser(Object(eZ\Publish\Core\Repository\Values\User\User), Object(eZ\Publish\API\Repository\Values\User\UserUpdateStruct))
            #9 /var/www/ezpublish-community/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Repository/Repository.php(299): EzSystems\BehatBundle\ObjectManager\User->EzSystems\BehatBundle\ObjectManager\{closure}(Object(eZ\Publish\Core\Repository\Repository))
            #10 /var/www/ezpublish-community/ezpublish/cache/behat/ezpublishBehatDebugProjectContainer.php(23651): eZ\Publish\Core\Repository\Repository->sudo(Object(Closure))
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              joao.inacio-obsolete@ez.no Joao Inacio (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: