-
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
Deprecate FunctionNode without TypedExpression #8024
Comments
Should this be added to the 3.0 milestone? A recent discussion inspired me to see if I could help find old issues to close. In my browsing I found #4641 + the accompanying PR + this issue. It doesn't seem that big of a change or that much of a headache on the user-side to add this to a 2.x release before 3, but I don't know how when the team is trying to ship out 3.x. |
As long as nobody's actively working on this issue, we don't add it to a milestone. |
Alright, makes sense I guess #8025 is waiting on this issue to be hammered out first. I was thinking it might be good to finish what's already been started (the Count and Length DQL functions have implemented this interface). If it's a BC break then I'm assuming it gets pushed to 4.0 if no one's working on it. If you or anyone else can give me some pointers/tips on what to do, I can try working on this. But I'm guessing the steps are:
|
@Aweptimum yes sounds like a plan. As for 5, indeed in ctor of type, check when its not implementing the interface and log a deprecation as other code does. As for migration in 3.x code, the interface can go away when FunctionNode just assimilates its behavior. |
Hey @beberlei, I started working on this some. I was wondering if the logic you added in your Identity PR could be extracted to a trait? For any of the AST functions that have a return type dependent on the input. Mainly the aggregates like: abs, max, min, sum. Also, I'm not 100% certain on all of the return types in general. I'm assuming the types constants are now found in the Types class rather than the Type class where your PR references them. Here's my best guess at the types, with a union type for reference: Numeric: Bigint | Integer | Smallint | Decimal | Float
Datetime:
String Functions:
I'm probably also missing where types like GUID, JSON, BLOB/BINARY, and BOOLEAN come in |
@Aweptimum the changes in the Identity PR are so small, what do you want to use as a trait there? As for the types, I believe you are correct with everything Date_Diff is an integer yes. Everything should have functional tests as well, so you see when and what you get wrong. |
@Aweptimum rereading the comments on #7941 i realized that we have to be careful with functions and converting to float due to the casting imprecision. If for example SUM is over a float/decimal type, then it should return as string. |
The Identity function has logic for determining the requested column type to figure out the return type (since the identifier could be any type). It seems like it'd be useful to put that in a But in the case of MAX/MIN you can use those on most types (I don't think arrays, json, or binary data is acceptable), so it might be handy to bundle field checking into a method (is it a field or an association? if field -> field type, if association -> association identifier's type). Although it is slightly different from the identity function |
So I noticed in the 2.16 branch a note on orm/lib/Doctrine/ORM/Utility/PersisterHelper.php Lines 29 to 59 in 609647a
|
In next major version we should make DQL TypedExpression a part of FunctionNode, which requires to deprecate it first in 2.x
This was introduced in #7941
Also related to #8025 - where identity now converts types. This is actually starts converting now, which we should consider a BC break.
What about introducing a query hint that starts converting function nodes, and when the query hint is not set, then we emit a deprecation?
The text was updated successfully, but these errors were encountered: