tags:

views:

128

answers:

1

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?

A: 

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

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

Zack
Directly to andWhereIn, because it's merely one of many conditions, and not the first one added, at that. Do you know that it would act differently from whereIn? (I can't test it right now, but I rather suspect there to be no difference)
Rytmis
There should be no difference, however there have been situations where I couldn't get andWhereIn to work. whereIn implies 'and'
Zack