mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Parameter type checking has changed from v2.6.3 #6307
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @snebes on GitHub (Sep 25, 2019).
BC Break Report
Summary
The changes made in #7528 have altered the behavior from what worked in the previous version. Specifically this conditional:
https://github.com/doctrine/orm/pull/7528/files#diff-81228a4fb4c82b292a152dd3e1a40becR435
Previous behavior
Previously, if a
Parameteris passed with a defined$type, and that type did not match the actual$valueof the parameter, the correct type was inferred from Doctrine. This behavior occurred on this line:https://github.com/doctrine/orm/pull/7528/files#diff-81228a4fb4c82b292a152dd3e1a40becL407
Current behavior
The behavior has now been changed to blindly accepting the type that was included in the
Parameterobject as seen here:https://github.com/doctrine/orm/pull/7528/files#diff-81228a4fb4c82b292a152dd3e1a40becR435
How to reproduce
This change altered the behavior of queries that specifically, but incorrectly, set the type of a parameter. Take for example, a Course and Student relationship with a OneToMany relationship. Consider the following:
The generated SQL will be along the lines of:
Where ? would be:
Previously, this would resolve to the doctrine-mapped ID field. This now results in 0 entities being returned by
getResult, with no clear indication as to why.The flawed configuration of the
setParametermethod is the source of the problem, but it was allowed before this version.@snebes commented on GitHub (Sep 25, 2019):
And I should have checked first, this is a dupe of #7827