DoctrineJsonFunctions icon indicating copy to clipboard operation
DoctrineJsonFunctions copied to clipboard

Not working with doctrine/orm 3.0 and doctrine/lexer 3.0

Open Wimble84 opened this issue 1 year ago • 0 comments

Hi !

Symfony: 7.0.3 Doctrine ORM: 3.0 Doctrine Lexer: 3.0

When trying to use JSON_GET_TEXT on postgres DB like this

public function findAllByRoles(string $role): array 
{
        $qb = $this->createQueryBuilder('u');
        $qb
            ->where("JSON_GET_TEXT(u.roles, 0) = :role")
            ->setParameter('role', $role)
            ->orderBy('u.lastname', 'ASC')
            ->addOrderBy('u.firstname', 'ASC');

        return $qb->getQuery()->getResult();
}

I get this error Undefined constant Doctrine\ORM\Query\Lexer::T_IDENTIFIER

Before doctrine/orm and doctrine/lexer 3.0, tokens are stored directly as constants. But now (in 3.0) tokens are stored in TokenType Enum

Wimble84 avatar Feb 09 '24 20:02 Wimble84