Crud operations are provided by the SensioGeneratorBundle which is included in the symfony standard distribution.
You can use the following command to generate form, templates & controller for existing entitites. It is interactive and can also update your routing automatically.
app/console generate:doctrine:crud
entity classes themselfes can be created with another command - interactive aswell.
app/console generate:doctrine:entity
Generating entities from database is done with:
app/console doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm --from-database --force
which will create xml mapping files. Afterwards you can generate entities as follows:
app/console doctrine:mapping:import AcmeBlogBundle annotation
app/console doctrine:generate:entities AcmeBlogBundle
This would generate the entities with annotations. yml and xml are supported aswell!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…