zf2 generating entity with doctrine ORM

眉间皱痕 提交于 2019-12-06 15:31:15

If you change the structure of your Entity file a simple \vendor\bin\doctrine-module orm:schema-tool:update --force will alter the table according to your Entity definition.

If you still want to recreate the table simple drop the table from your mysql and run the update command. You may have some cache files left so clearing those might be a good Idea, too.

You can clear the complete cache like so:

\vendor\bin\doctrine-module orm:clear-cache:query 
\vendor\bin\doctrine-module orm:clear-cache:result
\vendor\bin\doctrine-module orm:clear-cache:metadata

As mentioned above it might be a bad practice, but nevertheless I use the following commands to achieve the result you are asking about:

vendor\bin\doctrine-module orm:convert-mapping --filter='Evaluation' --namespace='MyModule\Entity\\' --force --from-database annotation ./module/MyModule/src/   

and another command to generate getters and setters:

vendor\bin\doctrine-module orm:generate-entities --filter='Evaluation' ./module/MyModule/src/ --generate-annotations=true
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!