Reputation: 122
I am trying to generate Entity from database but it only add id automatically. Is there any console command to automatically generate entity with all fields from db?
Upvotes: 0
Views: 660
Reputation: 1587
Yes, You can use Doctrine reverse engineering
available in Symfony SE. Check the doc here.
The command will be :
php bin/console doctrine:mapping:import --force AcmeBlogBundle xml
Where The ORM entities will be imported to AcmeBlogBundle
with xml
format. you can change the format of your ORM
later with annother command. Please check the document for full usage.
Note :
Upvotes: 2
Reputation: 7764
There is a console command below to automatically generate setter/getters etc... for an Entity class that you've created:
php bin/console doctrine:generate:entities AppBundle/Entity/Product
In the above example, the file under 'src/AppBundle/Entity/Product.php' would be the Entity class.
Is this what you were looking for?
Upvotes: 0