title: doctrine how to write WhereIn() with another sql query inside
body: <p>i have the folowing query in SQL</p>
  
  <pre><code>... where group_id IN (select group_id from alert where monitor_id = 4);
  </code></pre>
  
  <p>I want to write it in Doctrine but i don't know how to add the IN select into WHEREIN() clause !
  any idea ?</p>
  
  <p>this is what i did </p>
  
  <pre><code>$q = $this-&gt;createQuery('u') 
      -&gt;select('u.email_address') 
      -&gt;distinct(true)
      // -&gt;from('sf_guard_user u') 
      -&gt;innerJoin('u.sfGuardUserGroup ug') 
      -&gt;where('ug.group_id IN(select group_id from alert where monitor_id=?',$monitor);     
  
  $q-&gt;execute(); 
  </code></pre>
  
  <p>In the sfGuardUserTable.class:</p>
  
  <pre><code>public function getMailsByMonitor($monitor) {
  
  
          $q = Doctrine_Query::create()-&gt;from("alert a")-&gt;where("a.monitor_id", $monitor);
          $groups_raw = $q-&gt;execute(array(), Doctrine_Core::HYDRATE_ARRAY);
          $groups = array();
          print_r($groups_raw);
          foreach ($groups_raw as $gr) {
              $groups[] = $gr-&gt;id; //line 33
          }
  
  
          $q2 = $this-&gt;createQuery('u')
                  -&gt;select('u.email_address')
                  -&gt;distinct(true)
                  -&gt;innerJoin('u.sfGuardUserGroup ug')
                  -&gt;whereIn("ug.group_id", $groups);
          return $q2-&gt;execute();
      }
  </code></pre>