在Zend Framework 2中从数据库创建单个表的实体 [英] Create Doctrine entity of single table from database in Zend Framework 2

查看:194
本文介绍了在Zend Framework 2中从数据库创建单个表的实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的ZF2项目中配置了原则ORM,并创建了整个数据库的原则实体。现在,我在数据库中再添加了一个名为 dashboard_group 的表。只能为此表创建Doctrine实体。



我不想替换其他创建的实体。

解决方案

在您的命令中使用 -filter 选项:

  ./ vendor // bin / doctrine-module orm:convert-mapping --namespace =YourModule\\Entity\\ --force --from-database --filter =dashboard_group注解./module/MonModule/src/ 

然后将setter / getter添加到生成的实体中:

  ./ vendor / bin / doctrine-module orm :generate-entities ./module/YourModule/src/ --generate-annotations = true --filter =dashboard_group


I have configured doctrine ORM in my ZF2 project and create doctrine entity of whole database. Now, I have added one more table named dashboard_group in database. How can I create Doctrine entity for only this table.

I don't want to replace other created entities.

解决方案

Use –filter option in your command :

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

And then to add setter/getter into the generated entity :

./vendor/bin/doctrine-module orm:generate-entities ./module/YourModule/src/ --generate-annotations=true --filter="dashboard_group"

这篇关于在Zend Framework 2中从数据库创建单个表的实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆