从Doctrine实体创建/更新模式 [英] Creating/updating schema from Doctrine entities
问题描述
由于注释已经包含信息,因此应该可以基于他们。我不想重新发明,所以我想知道这种逻辑是否已经存在?
你可以使用这个教条CLI,对于很多学说相关的任务。我不知道如何将教义整合到Zend中,但是寻找doctrine.php,并且这样调用:
php doctrine.php orm:schema-tool:update --force
这将更新您的数据库以匹配您的模式定义。您还可以使用
php doctrine.php orm:schema-tool:update --dump-sql
查看什么SQL命令将会运行原理。请参阅工具部分该教义将会提供更多信息。
I'm using Doctrine with Zend Framework. I have to create both the DB schema and the Doctrine entities with annotations.
Since the annotations already contain the information, it should be possible to create/update the schema based on them. I don't want to reinvent the wheel, so I was wondering whether that kind of logic already existed?
You can use the doctrine CLI, for a lot of doctrine related tasks. I'm not sure how doctrine is integrated into Zend, but look for the doctrine.php, and invoke it like this:
php doctrine.php orm:schema-tool:update --force
This will update your db to match your schema definitions. You can also use
php doctrine.php orm:schema-tool:update --dump-sql
To see what SQL commands would doctrine run. See the Tools section in the doctrine docs for more information.
这篇关于从Doctrine实体创建/更新模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!