DoctrineJsonFunctions
DoctrineJsonFunctions copied to clipboard
How to use JSON_OBJECT with setParameters
Hi,
How can I use JSON_OBJECT with setParameters?
When try to use it like this:
$qb = $em->createQueryBuilder()
->select('count(q)')
->from(MyClass::class, q)
->andWhere('q.myArray = JSON_OBJECT(:key, :value)')
->setParameters([
'key' => "name",
'value' => "Max"
])
$ab->getQuery()->getSingleScalarResult();
I get following error:
[Doctrine\ORM\Query\QueryException] [Syntax Error] line 0, col 122: Error: Expected string, got ':utmParameterKey'
Thank you for your help!
Michi