FOS UserBundle UserManager :: __ construct必须是ObjectManager的实例

问题描述

重新安装symfony 4.4,然后重新安装symfony flex和一些常用食谱,然后我试图设置fos userbundle,但遇到这个问题,我无法解决

Argument 3 passed to FOS\UserBundle\Doctrine\UserManager::__construct() must be an instance of Doctrine\Common\Persistence\ObjectManager,instance of Doctrine\ORM\EntityManager given,called in /srv/www/alexseif/var/cache/dev/ContainerYzHcxci/srcApp_KernelDevDebugContainer.PHP on line 1660

解决方法

除了不再维护FOSUserBundle,因此不应该在新项目中使用它,我也必须解决此问题:

在我的情况下,将"doctrine/common": "^2.8",添加到composer.json就足够了。