Error while trying to update Pimcore from 5.1.3 to 5.4

Hi

I am following this guide https://pimcore.com/docs/5.x/Development_Documentation/Installation_and_Upgrade/Upgrade_Notes/Within_V5/Update_from_5.x_to_5.4_or_above.html for updating, but at step 6., when I run `php ./bin/console cache:clear’ I get following error:

PHP Fatal error:  Uncaught Symfony\Component\DependencyInjection\Exception\RuntimeException: Cannot autowire service "Pimcore\Helper\LongRunningHelper": argument "$connectionRegistry" of method "__construct()" references interface "Doctrine\Common\Persistence\ConnectionRegistry" but no such service exists. It cannot be auto-registered because it is from a different root namespace. in /home/pimcore/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass.php:37
Stack trace:
#0 /home/pimcore/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php(60): Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->processValue(Object(Symfony\Component\DependencyInjection\Definition), true)
#1 /home/pimcore/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass in /home/pimcore/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass.php on line 37

Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\RuntimeException: Cannot autowire service "Pimcore\Helper\LongRunningHelper": argument "$connectionRegistry" of method "__construct()" references interface "Doctrine\Common\Persistence\ConnectionRegistry" but no such service exists. It cannot be auto-registered because it is from a different root namespace. in /home/pimcore/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass.php:37
Stack trace:
#0 /home/pimcore/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php(60): Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->processValue(Object(Symfony\Component\DependencyInjection\Definition), true)
#1 /home/pimcore/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass in /home/pimcore/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass.php on line 37

I am using PHP 7.2. It seems like Doctrine related error. Any ideas how to tackle this?

Because of this error I also can’t run manual migrations php7.2 manual-migration.php 197 since it produces same error.

what version are you currently on? try updating to the next major one. then it should work.

(Guess it is a pimcore fuck-up where they inject the wrong service name)

This error is with 5.4.*.

I thought it is good idea to first upgrade to 5.4 and run manual migration steps and then go from there.

I tried putting 5.* to composer.json, but then I got different error. I’ll do it again, maybe that error is easier to solve.

It seems that v5.4 is broken after Doctrine changed some stuff, so skipping 5.4 and updating to 5.6 or higher resolved the issue…

As long as you’re on pimcore < 5.6 you need to add a service declaration manually.
Just create a _legacy.yml and include it in your app/config/config.yml:

Add to app/config/config.yml:

imports:
    - { resource: _legacy.yml }

Add file app/config/_legacy.yml:

services:
    _defaults:
        public: true

    Doctrine\Common\Persistence\ConnectionRegistry: '@doctrine'

Don’t forget to remove it after you’re on pimcore > 5.6.

1 Like