没有主键的实体的 Symfony 学说模型 [英] Symfony Doctrine Models for Entity Without Primary Keys
本文介绍了没有主键的实体的 Symfony 学说模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在重新构建 Web 应用程序时,我正在使用旧数据库.我想使用 Symfony2.x,它显然将 Doctrine 作为 ORM.
I'm working with a legacy database while re-building the web application. I want to use Symfony2.x which obviously has Doctrine as ORM.
我有大约 50 个 (mysql) 表,它们没有主键.当我尝试生成模型时,它不允许我这样做并抛出No Primary Key on ... table"异常.
I've around 50 (mysql) tables which has NO Primary Keys. When I try to generate models, it does not let me do and throw an exception with "No Primary Key on ... table".
我必须在表上设置主键才能使用 Doctrine,还是有什么办法可以解决?
Do I must have Primary Keys on tables to use Doctrine or is there any way around it?
任何帮助都会很棒.
谢谢.
推荐答案
Doctrine 要求每个实体类都有一个标识符/主键.
Doctrine requires every entity class to have an identifier/primary key.
这篇关于没有主键的实体的 Symfony 学说模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文