`LinksHandlerTrait` still uses `WITH` for an arbitrary join, which deprecated since Doctrine ORM 3.6 (follow-up to #8394)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
Research direction
Start at src/Doctrine/Orm/State/LinksHandlerTrait.php around lines 121-128, where an entity-class join is built with the 'WITH' keyword; read the original analysis in issue #8394 to see which Link configurations reach this branch. Check how the installed doctrine/orm version can be detected (ORM's UPGRADE.md documents the deprecation under 3.6) and swap to Join::ON for versions that accept it while keeping 'WITH' for doctrine/orm ^2.17 || ^3.3. Done looks like: no deprecation notice from Parser.php when querying a subresource Link against doctrine/orm 3.7, and existing Doctrine ORM tests still pass.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- PHP
- Stars
- 2.6k
- Forks
- 987
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 91
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from api-platform/core
-
`OrderExtension` and `OrderFilter` pass string sort directions, deprecated since `doctrine/orm` 3.7Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
api-platform/core#8648 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
api-platform/core#8647 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
api-platform/core#8612 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
api-platform/core#8646 ·
Maintainers usually reply within 1 day
-
PartialSearchFilter: ESCAPE '\' breaks multi-value queries on PostgreSQL with PHP < 8.4 (HY093)Open
Difficulty 3/5 1-2 days Newbie friendliness 75/100
api-platform/core#8642 ·
Maintainers usually reply within 1 day
All issues in api-platform/core
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
coollabsio/shoutrrr#190 ·
-
Bug Enhancement Performance
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Feature Status: Needs Triage
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
frontend low-priority
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
mplodowski/dynamicpdf-plugin#336 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AdvancedCustomFields/acf#1044 ·