Doctrine2: Arbitrary join and single table inheritance(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:任意连接和单表继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Doctrine2:任意连接和单表继承
基础教程推荐
- 如何替换eregi() 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
