I created several classes without using the php command php app/console doctrine:generate:entity
, directly I created and mapping the php classes in the folder MyBundle/Entity
.
What is the command to generate these classes as Doctrine entities and Mysql tables?
Assuming you have all the needed annotations and correct getters / setters in your php files, it should be enough to call php app/console doctrine:schema:update --force
. For preview purposes ypu can use php app/console doctrine:schema:update --dump-sql
. That will show you the sql which will be executed.
If you only have annotated properties without getters / setters (so you have created the php files, added properties which you want as columns and added their respective annotations), first use php app/console doctrine:generate:entities MyBundle/Entity
. This will create the getters/setters for you. Check here for additional information.
I recommend you to use migration mechanism. There is great tool for the Symfony (DoctrineMigrationsBundle)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With