Doctrine added native support for PHP8.1 enumeration types. It looks like it works on entity side as expected (saving entity on DB and hydration while fetching entity works as intended). But while I try to fetch entity using repository query builder with where clause on enum field it throws an exception due to casting problems.
For example
$em->getRepository(SomeEntity::class)
->createQueryBuilder('s')
->where('s.enumStatus = :status')
->setParameter('status', EnumStatus::Pending)
->getQuery()
->getResult();
will result in
Object of class EnumStatus could not be converted to string
in vendor/doctrine/dbal/src/Driver/PDO/Statement.php (line 50)
Of course i can omit problem by doing ->setParameter('status', EnumStatus::Pending->value)
but this is kind of weird.
Em i doing something wrong or it just meant to be like this?