-
-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Sylius version affected: 1.10.4
sylius/fixtures-bundle: v1.7.0
Steps to reproduce
installing mongodb
composer require doctrine/mongodb-odm-bundle (with 1 recipe)
run
php bin/console cache:clear
Description
from
php bin/console cache:clear
[WARNING] Some commands could not be registered:
In MongoDBPurgerListener.php line 26:
Argument 1 passed to Sylius\Bundle\FixturesBundle\Listener\MongoDBPurgerListener::__construct() must be an instance of Doctrine\Common\Persistence\ManagerRegistry, instance of Doctrine\Bundle\MongoDBBundle\ManagerRegistry given, call
ed in D:\laragon\www<project>\var\cache\dev\Container8g1zyaR\getListenerRegistryInterfaceService.php on line 34
Problem
The problem is that the type hints in the code refer to a class that doesn't exist
https://github.com/Sylius/SyliusFixturesBundle/blob/master/src/Listener/MongoDBPurgerListener.php#L17
The Doctrine\Common\Persistence\ManagerRegistry class exists in doctrine/common 2.8
https://github.com/doctrine/common/blob/2.8/lib/Doctrine/Common/Persistence/ManagerRegistry.php
but it was removed in 2.9
https://github.com/doctrine/common/blob/2.9/lib/Doctrine/Common/Persistence/ManagerRegistry.php
Possible Solution
In vendor/sylius/fixtures-bundle/src/Listener/MongoDBPurgerListener.php
(https://github.com/Sylius/SyliusFixturesBundle/blob/master/src/Listener/MongoDBPurgerListener.php)
update
use Doctrine\Common\Persistence\ManagerRegistry;
to
use Doctrine\Persistence\ManagerRegistry;
This problem was found also in other libraries. e.g. api-platform/core#3683