-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
make:user gives 'Cannot find the entity manager for class "App\Entity\User" ' if App\Entity is not empty #1158
Comments
Howdy @Adi-18 - i'm unable to replicate this locally. Can you provider a simple re-producer app that demonstrates this error? Another thing to check out is your In a fresh 6.1 app, it should look something like: doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '13'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App For the user entity (Using Postgres) #[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\Table(name: '`user`')]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
... Also, at what point are you getting that error message when running the |
Hi @jrushlow |
Hi, Check your Doctrine config, it fix the problem in my project: I don't have the "doctrine.orm.mappings.App.type: attribute" set ...and have entities with annotations, not attributes.... Thanks to : this post in stackoverflow |
I can confirm @gbtux answer. It seems that MakerBundle will write either I produced the opposite, |
I ran into the same issue. I set up a completely new installation of Symfony 5.4.11 with Maker-Bundle 1.45.0. And I am already running on PHP 8.1.0. and therefore set With this setup, I run into the mentioned error. When I add |
I confirm that the solution given by @gbtux worked fine for me. Thanks! |
Yes that makes sense. We dropped Thinking of how we can provide better DX to say "Hey, you're using annotations, maker only uses attributes..." |
I'm from Brazil, I used the tips from all of you here and made the following modification, I added the attribute "type: attribute" and it worked, I also did the test with the annotation, but for this case it didn't work. |
Replicated on a fresh Symfony 6.1 installation
symfony/maker-bundle v1.44.0
Error: 'Cannot find the entity manager for class "App\Entity\User" '
after command 'symfony console make:user' and if there is already an Entity in App\Entity
The text was updated successfully, but these errors were encountered: