简体   繁体   中英

Can I use whereIn in a query with named parameters?

I'm working on a Symfony app that uses Doctrine as the ORM. I want to run a query with an WHERE foo IN (bar) clause, and I'm adding the IN bit like so:

$query->andWhereIn('p.foo', $bar);

where $bar is an array of id numbers. Browsing the docs and trying out a few combinations, I was unable to make Doctrine treat the parameter I'm passing there as a named parameter.

As a result, I'm forced to use positional parameters for the rest of the query, too, as you can't mix the two. What, if anything, am I missing?

我为此http://www.doctrine-project.org/jira/browse/DC-1003?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel编写了一个补丁,该补丁从未提交,但确实有处理这种情况。

andWhereIn() is simply a proxy method for whereIn()

Have you tried to use whereIn() or did you skip directly to andWhereIn() ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM