Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use JSON_OBJECT with setParameters #94

Open
michilehr opened this issue Sep 7, 2023 · 0 comments
Open

How to use JSON_OBJECT with setParameters #94

michilehr opened this issue Sep 7, 2023 · 0 comments

Comments

@michilehr
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant