-
Notifications
You must be signed in to change notification settings - Fork 66
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
Command execution error "Cannot find the entity manager" #247
Comments
I had the very same problem and I think it's related to Doctrine. Annotations instead of attributes were used in entities. I've updated project's code using Rector (see Upgrading & What's New in Symfony 6!), and now it is working as expected. |
Howdy @jogoool, @fundo-moretti is correct - this is caused by the mapping type (annotation/attribute) that your app is using. It sounds like you're using attributes for your entities but the |
Do you use annotations or attributes? For me with attributes, the following works:
|
Well, if you have the same error, you could probably fix it by converting your entity mapping type from annotation to attribute (see above). |
What is the good way for that ? |
As I said, see above. I mean, read chapters 03 Automating Upgrades with Rector and 04 Post-Rector Cleanups & Tweaks of this Symfonycast Upgrading & What's New in Symfony 6!. Here's the
If you don't want to use Rector, manually change annotations |
The project totally uses attributes but I face the same issue. |
I see the latest version of MakerBundle has an improved error message: https://github.com/symfony/maker-bundle/blob/a3b7f14d349f8f44ed752d4dde2263f77510cc18/src/Doctrine/DoctrineHelper.php#L92
So it hints that you need to use PHP attributes. Not much else we can do here, because annotation support is dropped completely here. @astronati Could you provide more context, please? All your entities use PHP attributes mapping instead of annotations? How about this config in
Do you have |
@bocharsky-bw Thanks for your message, and sorry for the late reply. Unfortunately, the project was abandoned, so I didn’t spend more time investigating it. If I end up working on something similar in the future, I’ll let you know in this thread. |
after installing the bundle the
make:reset-password
command could not generate all the files, I got errorCannot find the entity manager for class "App\Entity\ResetPasswordRequest"
created: src/Controller/ResetPasswordController.php
created: src/Entity/ResetPasswordRequest.php
In DoctrineHelper.php line 91:
Cannot find the entity manager for class "App\Entity\ResetPasswordRequest"
The text was updated successfully, but these errors were encountered: