-
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 type inference in Query::setParameter
#8379
Comments
In addition we should think about differentiating between
|
Needs more research |
The optional type argument on setParameter() and the baked in behaviour of inferType() for booleans and datetimes is confusing and sets the wrong expectation for consumers. I've just been digging into this to understand why these types were treated differently from other registered types. We will be updating our company coding standard to mandate that the type is always specified for consistency and clarity (obviously Connection::PARAM_STR_ARRAY etc. isn't ideal). I would welcome this change in Doctrine. |
We should assume every object passed must be an entity or specify a $type as third argument. Only primitive types should work with type inference. A deprecation is in order to allow users. to migrate of this behavior.
Problems with type inference:
DateTime
, todatetime
ordatetime_utc
. Insufficient autodetection of query parameter type #6443The text was updated successfully, but these errors were encountered: