2

is it possible to make :

$q->createQuery('q')
  ->whereIn('q.id', $q2)

Where $q2 is an other Doctrine_Query object. Because my subquery is complex and I don't want to write it in SQL...

Mohammed H
  • 6,880
  • 16
  • 81
  • 127
Charles
  • 11,367
  • 10
  • 77
  • 114

2 Answers2

2

Unfortunately, according to the Doctrine API documentation, you can't pass another query object to whereIn(), so you will have to fetch your ID-s beforehand and pass them in an array. Be careful though, because if you pass an empty array, then there will be NO FILTERING for those ID-s. In other words: it will return all rows present in your table, instead of none.

Imi Borbas
  • 3,683
  • 1
  • 19
  • 16
0

While using whereIn the parameter should be an array. You can use execute(array(), Doctrine_Core::HYDRATE_ARRAY) to return an array instead of an object.

Jubayer Arefin
  • 485
  • 7
  • 17