Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doctrine] Argument 1 passed to Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter::__construct() must be an instance of Doctrine\Common\Persistence\ManagerRegistry or null, instance of Doctrine\Bundle\DoctrineBundle\Registry given #37935

Closed
jhfyang opened this issue Aug 25, 2020 · 11 comments

Comments

@jhfyang
Copy link

jhfyang commented Aug 25, 2020

Just installed with Symfony-CLI a new project in 5.1.3

When using doctrine I get this errror:

Argument 1 passed to Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter::__construct() must be an instance of Doctrine\Common\Persistence\ManagerRegistry or null, instance of Doctrine\Bundle\DoctrineBundle\Registry given, called in /home/yang/Projects/noyz-symfony/var/cache/dev/ContainerZxrp7lI/App_KernelDevDebugContainer.php on line 1512

Indeed when looking we have Doctrine\Bundle\DoctrineBundle\Registry extends Symfony\Bridge\Doctrine\ManagerRegistry and not Doctrine\Common\Persistence\ManagerRegistry as expected in at DoctrineParamConverter

Possible fix would be to change in DoctrineParamConverter.php:
use Doctrine\Common\Persistence\ManagerRegistry;
to
use Symfony\Bridge\Doctrine\ManagerRegistry;

@fabpot
Copy link
Member

fabpot commented Aug 25, 2020

@fabpot
Copy link
Member

fabpot commented Aug 25, 2020

This is due to a BC break in Doctrine (see doctrine/DoctrineBundle#1202). Fixed in FrameworkExtraBundle with a new release (v5.6.0). Everything should work again.

@jhfyang
Copy link
Author

jhfyang commented Aug 25, 2020

@fabpot Thanks a lot !

@tomislavsantek
Copy link

I'm also having this issue on a fresh install of Symfony 4.4.11 skeleton project.

@virengawale
Copy link

I'm also having this issue on a fresh install of Symfony 4.4.11 skeleton project.

Facing same issue

@fabpot
Copy link
Member

fabpot commented Aug 26, 2020

Can you give some more information?

@ivleneb
Copy link

ivleneb commented Aug 26, 2020

I'm also having this issue on a fresh install of Symfony 4.4.11 skeleton project.

Facing same issue

Similar issue after "composer update" on symfony 4.4:
Argument 1 passed to
Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter::__construct() must be an
instance of Doctrine\Common\Persistence\ManagerRegistry or null, instance of
Doctrine\Bundle\DoctrineBundle\Registry given

@fabpot
Copy link
Member

fabpot commented Aug 26, 2020

Can you check that you are using the latest version of Symfony Extra Bundle?

@ivleneb
Copy link

ivleneb commented Aug 26, 2020

Can you check that you are using the latest version of Symfony Extra Bundle?

I'm using version 5.2, but in other machine i haven't any problem. I'll try updating to 5.6

@fabpot
Copy link
Member

fabpot commented Aug 26, 2020

You need v5.6.1.

@ivleneb
Copy link

ivleneb commented Aug 27, 2020

You need v5.6.1.

Yes, thank you, now it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants