Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

`LinksHandlerTrait` still uses `WITH` for an arbitrary join, which deprecated since Doctrine ORM 3.6 (follow-up to #8394)

未关闭 适合新手
#8,649 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
75/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
php
领域
backend

调研方向

从 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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

api-platform/core 的其他 Issue

查看 api-platform/core 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。