Doctrine (on Ubu开发者_StackOverflow社区ntu): What command generate models from database without delete existing models?(I add new tables soo i want update models) Thanks
If you're using Doctrine 1, you'll need to make use of Migrations. Migrations can either be written manually, or auto-generated one of a few different commands:
./doctrine generate-migration
./doctrine generate-migrations-db
./doctrine generate-migrations-models
Migrations can be a fairly complex topic, so I would read up on the documentation. You may also want to check out this slide show.
If you're using Doctrine 2, things get a little simpler. It doesn't have a Migrations class (yet), but there an easy-to-use command to non-destructively update your db schema:
./doctrine orm:schema-tool:update
This has worked well for me, but can sometimes fail due to complex foreign key constraints.
精彩评论