I’m encountering an issue with Doctrine in my Symfony project. When I try to run the command doctrine:mapping:import (php bin/console doctrine:mapping:import "AppEntity" annotation –path=src/Entity), I get an error saying that the command is not defined. However, I can see other Doctrine commands listed when I run php bin/console list doctrine.
Here are the steps I’ve taken:
Created a Symfony project using Symfony 5.4.
Installed Doctrine using Composer (composer requires doctrine/annotations).
Checked the list of available Doctrine commands using php bin/console list doctrine, and doctrine:mapping:import is not listed.
I’ve checked the documentation, and it seems like doctrine:mapping:import should be a valid command. What could be causing this issue? Is there something else I need to install or configure to make this command available?
Any insights or suggestions on how to resolve this would be greatly appreciated. Thank you!
2
Answers
See Official notice from Symfony.
This command is deprecated and you have to use
make:entity
.Play with composer.json and change these like;
After changing the composer please
composer update
And run
php bin/console doctrine:mapping:import "AppEntity" annotation --path=src/Entity
And then
php bin/console make:entity --regenerate AppEntity