Multiple primary keys with Doctrine 1 and Symfony 1?(Doctrine 1 和 Symfony 1 的多个主键?)
问题描述
我已经知道在 Symfony 1 和 Doctrine 1 中不能使用多个主键,但是你们知道有什么好的解决方法吗?
I already know that's not possible to work with multiple primary keys in Symfony 1 and Doctrine 1, but do you guys know any good workarounds?
推荐答案
一种常见的解决方法是在多对多解析器表中添加一个 auto_increment 键,而不是定义关系,只需建立标准的外键关系即可桌子.只要您在两列上都有索引,性能就可以了.
A common workaround is to add an auto_increment key to the many-to-many resolver table, and rather than have defining relationships, just make standard foreign key relationships to the tables. As long as you have an index on the two columns performance will be fine.
这篇关于Doctrine 1 和 Symfony 1 的多个主键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Doctrine 1 和 Symfony 1 的多个主键?


- SoapClient 设置自定义 HTTP Header 2021-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- Laravel 仓库 2022-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01