Doctrine Command 'doctrine:mapping:import' is not defined in Symfony project

184 Views Asked by At

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 "App\Entity" 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

There are 2 best solutions below

0
b126 On

See Official notice from Symfony. This command is deprecated and you have to use make:entity.

0
selcuk mart On

Play with composer.json and change these like;

"doctrine/doctrine-bundle": "^2.10",
"doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/orm": "2.15",

After changing the composer please composer update

And run php bin/console doctrine:mapping:import "App\Entity" annotation --path=src/Entity

And then php bin/console make:entity --regenerate App\Entity