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 和教义从现有数据库生成单个实体
基础教程推荐
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01