How to generate entities from database schema using doctrine-orm-module and zf2

≯℡__Kan透↙ 提交于 2019-12-02 17:39:14

We use a batch script:

@ECHO OFF

mkdir EXPORT
call .\vendor\bin\doctrine-module orm:convert-mapping --force --from-database annotation ./EXPORT/
call .\vendor\bin\doctrine-module orm:generate-entities ./EXPORT/ --generate-annotations=true

pause 

orm:convert-mapping and orm:generate-entities is probably what you are looking for.

There's a nice blog written on this here

Edit: It can be done by using the commands below:
1. convert-mapping (Table & Entity):

  ./vendor/doctrine/doctrine-module/bin/doctrine-module orm:convert-mapping --namespace="Album\\Entity\\" --force  --from-database annotation ./module/Album/src/


2. Generates getter and setter

   ./vendor/doctrine/doctrine-module/bin/doctrine-module orm:generate-entities ./module/Album/src/ --generate-annotations=true
Agnaldo Junior

Try just it

doctrine orm:convert-mapping -f --from-database annotation entities/

doctrine orm:generate-entities --generate-annotations="true" entities/

http://wildlyinaccurate.com/useful-doctrine-2-console-commands/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!