Doctrine Join 条件类型中的 WITH 和 ON 有什么区别?

2022-01-16 00:00:00 php doctrine doctrine-orm

我正在寻找关于教义条款的 WITH 和 ON 条件类型之间区别的更好解释.

I'm searching for a better explanation about the difference between WITH and ON condition type for the doctrine clausure.

我正在寻找关于这个非常糟糕的文档,但我仍然有疑问.

I'm finding the documentation about this very poor and I'm still in doubt.

推荐答案

在我看来,这有点像是原则 1 的遗留问题.

In my opinion it's kind of a left over from doctrine 1.

当时ON用于重新定义关系的连接条件,而WITH用于在默认连接条件的基础上增加更多的连接条件.

Back then ON was used to redefine the join conditions of relations, whereas WITH was used to add more join conditions to the default one.

现在在学说 2 中,我从未见过可以使用 ON 的情况.事实上,使用 ON 总是会出现异常,提示您应该使用 WITH.

Now in doctrine 2 I have never seen a situation where ON can be used. In fact using ON always ends up in an exception saying you should use WITH.

现在 WITH 可用于将连接条件添加到关系中定义的默认条件,或者,如果两个实体之间不存在关系,则定义连接条件.

Right now WITH can be used to add join conditions to the default one defined in a relation or, if no relation exists between two entities, define the join condition.

相关文章