mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Binding parameters optimisation for BackedEnum (array of BackedEnum values)
#7331
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 @AlexMinaev19 on GitHub (Feb 29, 2024).
Feature Request
According to the documentation, we can pass integers, arrays of strings/integers, DateTime instances, and managed entities to the
setParametermethod (or to the constructor ofDoctrine\ORM\Query\Parameterclass). It's not a full list, because we can pass alsoBackedEnumorarrayofBackedEnumvalues. Doctrine automatically infers which type you are setting as value.Also, the documentation says the following:
Unfortunately, the current implementation of supporting
BackedEnumas 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
BackedEnumparameters:StringBackedEnum-Doctrine\DBAL\Types\Type::STRINGIntBackedEnum-Doctrine\DBAL\Types\Type::INTEGERarray<array-key, StringBackedEnum>-Doctrine\DBAL\ArrayParameterType::STRINGarray<array-key, IntBackedEnum>-Doctrine\DBAL\ArrayParameterType::INTEGER@wmouwen commented on GitHub (Jul 7, 2025):
Related