-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicitly allow to use Comparison
and Composite
in JOIN conditions
#9022
Conversation
f5a2d43
to
436b65a
Compare
436b65a
to
833d981
Compare
Where does the conversion happen? |
orm/lib/Doctrine/ORM/Query/Expr/Join.php Lines 125 to 131 in 833d981
I don't know if there are more possibilities. These cases are what I have in my projects.
I considered this possibility, but as we might prefer to narrow the possibilities to classes we trust near its string representation, I decided to use them individually. |
@@ -104,7 +104,7 @@ public function getConditionType() | |||
} | |||
|
|||
/** | |||
* @return string | |||
* @return string|Comparison|Composite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @return string|Comparison|Composite | |
* @return string|Comparison|Composite|null |
Seems like nullability is not documented correctly on any of the getters. Or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that seems right IMO.
I didn't include this type because the same situation is present in other properties ($alias
, $conditionType
, $indexBy
).
I think we should make a separate PR for these cases, as I suspect this is not the only class affected by this issue.
WDYT?
* 2.9.x: Minor rewording (doctrine#8435) Don't presume one-to-one lookup returned an entity (doctrine#9028) Minor change about double The (doctrine#9038) Remove duplicate comment (doctrine#9036) Fix docblock types for some nullable properties (doctrine#9024) Explicitly allow to use `Comparison` and `Composite` in JOIN conditions (doctrine#9022) Fix some typehints in QueryBuilder Bump PHPStan (doctrine#9014) Add tests for advanced types in collection matching Use types in collection persister Signed-off-by: Alexander M. Turek <me@derrabus.de>
* 2.9.x: Minor rewording (doctrine#8435) Don't presume one-to-one lookup returned an entity (doctrine#9028) Minor change about double The (doctrine#9038) Remove duplicate comment (doctrine#9036) Fix docblock types for some nullable properties (doctrine#9024) Explicitly allow to use `Comparison` and `Composite` in JOIN conditions (doctrine#9022) Fix some typehints in QueryBuilder Bump PHPStan (doctrine#9014) Add tests for advanced types in collection matching Use types in collection persister Signed-off-by: Alexander M. Turek <me@derrabus.de>
These changes explicitly allow to use
Comparison
andComposite
in JOIN conditions.This is currently possible, but in an implicit way, since the values are silently converted to string as both classes are implementing the
__toString()
method.After these changes, PHPStan findings like this, can be resolved: