[PR #10058] Fix using enums with the QueryBuilder #12065

Closed
opened 2026-01-22 16:12:48 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/10058

State: closed
Merged: Yes


Fixes #10057.

After upgrading to version 2.13.2 I started getting the following error:

App\Enum\TestEnum::from(): Argument #1 ($value) must be of type string, App\Enum\TestEnum given

It happens when an enum is used with the QueryBuilder, eg:

$testRepository
    ->createQueryBuilder('t')
    ->where('t.enum = :type')
    ->setParameter('type', TestEnum::Foo)
    ->getQuery()->getResult()
;

Caused by #10041.

Since my knowledge of the ORM code base is limited I'm not sure if this is the best place to fix the bug, so any suggestions are appreciated.

**Original Pull Request:** https://github.com/doctrine/orm/pull/10058 **State:** closed **Merged:** Yes --- Fixes #10057. After upgrading to version `2.13.2` I started getting the following error: ``` App\Enum\TestEnum::from(): Argument #1 ($value) must be of type string, App\Enum\TestEnum given ``` It happens when an enum is used with the `QueryBuilder`, eg: ```php $testRepository ->createQueryBuilder('t') ->where('t.enum = :type') ->setParameter('type', TestEnum::Foo) ->getQuery()->getResult() ; ``` Caused by #10041. Since my knowledge of the ORM code base is limited I'm not sure if this is the best place to fix the bug, so any suggestions are appreciated.
admin added the pull-request label 2026-01-22 16:12:48 +01:00
admin closed this issue 2026-01-22 16:12:49 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#12065