无主键实体的 Symfony Doctrine 模型 [英] Symfony Doctrine Models for Entity Without Primary Keys
本文介绍了无主键实体的 Symfony Doctrine 模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在重新构建 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)表没有主键.当我尝试生成模型时,它不允许我这样做并抛出...表上没有主键"的异常.
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 Doctrine 模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文