Exemplo n.º 1
0
 /**
  * Query
  *
  * @param array $args
  * @return Doctrine_Query $q
  */
 protected function air_query($args = array())
 {
     $q = Doctrine_Query::create()->from('Tank t');
     $q->leftJoin('t.User u');
     $q->leftJoin('t.TankOrg to');
     $q->leftJoin('to.Organization o');
     $q->leftJoin('t.TankActivity ta');
     $q->leftJoin('ta.Project p');
     $q->leftJoin('ta.ActivityMaster m');
     if (isset($args['type'])) {
         air2_query_in($q, $args['type'], 't.tank_type');
     }
     if (isset($args['status'])) {
         air2_query_in($q, $args['status'], 't.tank_status');
     }
     // add flattened and return
     Tank::add_counts($q, 't');
     TankActivity::add_event_meta($q, 'ta');
     $q->addSelect('u.user_uuid as user_uuid');
     $q->addSelect('o.org_uuid as org_uuid');
     //TODO: not really flat
     $q->addSelect('p.prj_uuid as prj_uuid');
     //TODO: not really flat
     return $q;
 }
 /**
  * Query
  *
  * @param array $args
  * @return Doctrine_Query $q
  */
 protected function air_query($args = array())
 {
     $q = Doctrine_Query::create()->from('Tank t');
     $q->where('(t.tank_status = ?) or (t.tank_status = ?)', array(Tank::$STATUS_TSRC_CONFLICTS, Tank::$STATUS_TSRC_ERRORS));
     $q->leftJoin('t.User u');
     $q->leftJoin('t.TankOrg to');
     $q->leftJoin('to.Organization o');
     $defs = null;
     Tank::add_counts($q, 't', $defs, array(TankSource::$STATUS_CONFLICT, '*'));
     return $q;
 }