Generating a single Entity from existing database using symfony2 and doctrine(使用 symfony2 和教义从现有数据库生成单个实体)
问题描述
是否可以使用 Symfony2 控制台工具从数据库生成单个实体?
Is it possible to generate a single entity from database using the Symfony2 console tool?
在编码过程中,我不得不添加一个表,并对现有的实体类进行了修改.所以我不希望我的所有实体都重新生成.
In the middle of coding I had to add a table and there are modifications made to the existing entity classes. So I don't want all my entities regenerated.
任何建议将不胜感激!
推荐答案
我遇到了同样的问题,你必须这样做:
I had the same problem, you've to do this way:
php app/console doctrine:mapping:convert metadata_format
./src/App/MyBundle/Resources/config/doctrine
--from-database
--filter="Yourtablename"
然后
php app/console doctrine:mapping:import AppMyBundle
metadata_format --filter="Yourtablename"
其中 metadata_format 是您要生成的文件结尾(例如 xml、yml、注释)
Where metadata_format is the file ending you want to generate (e.g. xml, yml, annotation)
最后
php app/console doctrine:generate:entities AppMyBundle --no-backup
就像这个学说只会加载你需要的实体.请注意必须使用 CamelCase 的过滤器!
Like this doctrine will load only the entity you need. Just be carefull on the filter you must use the CamelCase !
希望对你有帮助
这篇关于使用 symfony2 和教义从现有数据库生成单个实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 symfony2 和教义从现有数据库生成单个实体
- 带有通配符的 Laravel 验证器 2021-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- Laravel 仓库 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
