Think the main part about how to use WHERE IN
has been answered many times.
Trying to combine two criteria like that won't work. Same way this SQL would never work:
select * from users where (id, email) IN ((1, 2), ('foo@gmail.com', 'bar@gmail.com'));
You would write that as
select * from users where id IN(1,2) AND email IN('foo@gmail.com', 'bar@gmail.com');
As of 2.5 I believe you would want:
$qb->andWhere('a.field1 IN (:fieldOneValues)')
->andWhere('a.field2 IN (:fieldTwoValues)')
->setParameter('fieldOneValues', $fieldOneValues)
->setParameter('fieldTwoValues', $fieldTwoValues);
UPDATE:
Now I understand better. The SQL I shared shows I didn't understand that syntax. How many values are you testing against? Could you approach it like?
(a.field1 = 1 AND a.field2 = 1) OR (a.field1 = 2 AND a.field2 = 2)
Doing an explain
on the query it actually seemed like MySQL leveraged keys much better with this method.