cast in doctrine query builder

25 Views Asked by At

I need help with this query:

 $qb->innerJoin(
            AdminAccount::class,
            'aa',
            Join::WITH,
            'gafl.key = :adminAccKeyName and gafl.oldValue = aa.id::varchar'
        );
        $qb->setParameter('adminAccKeyName', 'admin_account_id');
        $qb->setParameter('aaId', 'admin_account_id');

I use getEntityManager()->createQueryBuilder();

"errorMessage": "[Syntax Error] line 0, col 540: Error: Expected end of string, got ':'", 

If I try to use cast I have:

"errorMessage": "[Syntax Error] line 0, col 498: Error: Expected known function, got 'CAST'"

Нow can I compare fields of different formats?

I tried to debug in query console, if i use INNER JOIN admin_accounts a2_ ON (g0_.key = 'admin_account_id' AND cast(g0_.old_value as INT) = a2_.id) everything is working

0

There are 0 best solutions below