Doctrine 2是否需要定义外键? [英] Does Doctrine 2 required foreign keys to be defined?

查看:118
本文介绍了Doctrine 2是否需要定义外键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关系数据库,但是没有定义任何外键,许多表不是 InnoDB ,所以不能支持外键

I have a relational database, however, there aren't any foreign keys defined, and many of the tables are not InnoDB, so can't support foreign keys anyway.

我想开始在这个数据库上尝试使用Doctrine,但在文档中有很多关于外键的引用,所以我不知道这个是可能的。

I would like to start experimenting with Doctrine on this database, but there is a lot of reference to foreign keys in the documentation, so I'm not sure if this is possible.

我很担心潜水并将表存储引擎更改为 InnoDB 并定义吨外国键,因为我不想影响性能,如果我不需要。

I'm anxious about diving in and changing table storage engines to InnoDB and defining tons of foreign keys, because I don't want to impact performance if I don't have to.


  • Doctrine需要外键定义为了管理实体之间的联系?

  • 如果不需要但是可选,如果没有定义外键,我会牺牲Doctrine的哪些功能?

推荐答案

没有理由切换到InnoDB for Doctrine。

There is no reason for you to switch to InnoDB for Doctrine.


  1. 否。

  2. 我发现Doctrine的用于更新和生成数据库模式的CLI工具通常会尝试使用外键生成SQL。您可以手动设置数据库,或修改它生成的代码,以避免这种情况。

所以,强>,这不是问题。

So, no, it is not a problem.

这篇关于Doctrine 2是否需要定义外键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆