You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the documentation, we can pass integers, arrays of strings/integers, DateTime instances, and managed entities to the setParameter method (or to the constructor of Doctrine\ORM\Query\Parameter class). It's not a full list, because we can pass also BackedEnum or array of BackedEnum values. Doctrine automatically infers which type you are setting as value.
Also, the documentation says the following:
Even though passing DateTime instance is allowed, it impacts performance
as by default there is an attempt to load metadata for object, and if it's not found,
type is inferred from the original value.
Unfortunately, the current implementation of supporting BackedEnum as parameters (was added by PR) does not allow specifying the type of parameter manually to make performance optimization. If you try to specify Doctrine\DBAL\Types\Type::STRING, you get an exception.
Q
A
New Feature
yes
RFC
yes
BC Break
no
Summary
It would be nice to add support for explicitly passing type for BackedEnum parameters:
Feature Request
According to the documentation, we can pass integers, arrays of strings/integers, DateTime instances, and managed entities to the
setParameter
method (or to the constructor ofDoctrine\ORM\Query\Parameter
class). It's not a full list, because we can pass alsoBackedEnum
orarray
ofBackedEnum
values. Doctrine automatically infers which type you are setting as value.Also, the documentation says the following:
Unfortunately, the current implementation of supporting
BackedEnum
as parameters (was added by PR) does not allow specifying the type of parameter manually to make performance optimization. If you try to specifyDoctrine\DBAL\Types\Type::STRING
, you get an exception.Summary
It would be nice to add support for explicitly passing type for
BackedEnum
parameters:StringBackedEnum
-Doctrine\DBAL\Types\Type::STRING
IntBackedEnum
-Doctrine\DBAL\Types\Type::INTEGER
array<array-key, StringBackedEnum>
-Doctrine\DBAL\ArrayParameterType::STRING
array<array-key, IntBackedEnum>
-Doctrine\DBAL\ArrayParameterType::INTEGER
The text was updated successfully, but these errors were encountered: