Doctrine2:任意连接和单表继承

Doctrine2: Arbitrary join and single table inheritance(Doctrine2:任意连接和单表继承)
本文介绍了Doctrine2:任意连接和单表继承的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意:这是一个 ORM 限制在项目的问题跟踪器上报告

Note: This is an ORM limitation reported on the project's issue tracker

我在使用 Doctrine 2.3 中引入的任意连接语法在作为层次结构根的实体类上构建 DQL 查询时遇到问题.

I'm facing an issue building a DQL query using the arbitrary join syntax introduced in Doctrine 2.3 on an entity class which is the root of a hierarchy.

鉴于这些类:

A - 没有继承

B1 - 抽象,层次结构的根,鉴别器列被命名为类型"

B1 - abstract, root of a hierarchy, discriminator column is named 'type'

我设置了一个这样的查询生成器:

I setup a query builder like this:

$qb->select('a.id AS idA, b.id AS idB')
    ->from('EntityA', 'a')
    ->leftJoin('EntityB1', 'b', DoctrineORMQueryExprJoin::WITH, 'a.something=b.something');

SQL Doctrine 生成的内容是这样的:

And the SQL Doctrine generates is something like this:

SELECT a.id, b.id FROM a LEFT JOIN b ON (a.something=b.something) WHERE b.type IN ('1', '2', '3')

问题在于 where 使得 left join 无用.

The problems is that the where makes the left join useless.

有没有办法强制将鉴别器列上的条件放在连接中?至少那会让它...

Is there a way to force the condition on the discriminator column to be placed in the join? At least that would make it...

我应该填写错误报告吗?

Should I fill a bug report?

推荐答案

此错误已在 Doctrine 2.4 中修复

This bug is fixed in Doctrine 2.4

https://github.com/doctrine/doctrine2/issues/2934

这篇关于Doctrine2:任意连接和单表继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)