`LinksHandlerTrait` still uses `WITH` for an arbitrary join, which deprecated since Doctrine ORM 3.6 (follow-up to #8394)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 src/Doctrine/Orm/State/LinksHandlerTrait.php 的第 121-128 行左右开始,那里使用 'WITH' 关键字构建实体类的 join;阅读 issue #8394 中的原始分析,了解哪些 Link 配置会进入该分支。检查如何检测已安装的 doctrine/orm 版本(ORM 的 UPGRADE.md 在 3.6 下记录了该 deprecation),并在接受的版本上切换到 Join::ON,同时对 doctrine/orm ^2.17 || ^3.3 保留 'WITH'。完成的标志是:在 doctrine/orm 3.7 上查询 subresource Link 时 Parser.php 不产生 deprecation 通知,且现有的 Doctrine ORM 测试仍然通过。
由索引模型根据 Issue 内容生成。
描述
API Platform version(s) affected: 4.3.21, and the current heads of 4.4, 5.0 and main
This is follow-up to ticket #8394. The stale bot closed it on 2026-09-15 as "not planned", without any additional info and the code has not changed on 4.4, 5.0 or main so the problem still exists:
https://github.com/api-platform/core/blob/main/src/Doctrine/Orm/State/LinksHandlerTrait.php#L121-L128
$queryBuilder->join(
$fromClass,
$joinAlias,
'WITH',
"$previousAlias.{$previousJoinProperties[0]} = $joinAlias.{$associationMapping['fieldName']}"
);
This joins an entity class, not an association, so doctrine/orm 3.6+ reports:
Using WITH for the join condition of arbitrary joins is deprecated. Use ON instead. (Parser.php:1677 called by Parser.php:1549, https://github.com/doctrine/orm/issues/12192, package doctrine/orm)
I hit it on 4.3.21 with doctrine/orm 3.7.3 through a subresource Link. The original report in #8394 has a full analysis of which links take this branch.
Possible solution
Possible fix is to use Join::ON for this join on doctrine/orm versions that accept ON for arbitrary joins (ORM's UPGRADE.md lists the deprecation under 3.6), and keep 'WITH' for older versions, since API Platform still allows doctrine/orm ^2.17 || ^3.3.
I can open a PR for this if the proposed approach would fit.
- 主要语言
- PHP
- 星标
- 2.6k
- 派生
- 987
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 91
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
api-platform/core 的其他 Issue
-
`OrderExtension` and `OrderFilter` pass string sort directions, deprecated since `doctrine/orm` 3.7可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
api-platform/core#8648 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
api-platform/core#8647 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
api-platform/core#8612 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 68/100
api-platform/core#8646 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 75/100
api-platform/core#8642 ·
维护者通常 1 天内回复
查看 api-platform/core 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
coollabsio/shoutrrr#190 ·
-
Bug Enhancement Performance
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Feature Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
frontend low-priority
难度 2/5 1-3 小时 新手友好度 77/100
mplodowski/dynamicpdf-plugin#336 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
AdvancedCustomFields/acf#1044 ·