/**
  * Obtiene la lista de miembros de celula dado el id del lider, la lista
  * solo muestra los miembros que pueden habrir célula
  * @param integer $id_lider el Identificacor del lider
  * @return MiembroCelula Lista de miembros encontrados 
  */
 public function getMiembrosLideresPorLider($id_lider, $genero)
 {
     $q = new Doctrine_RawSql();
     $q->select('d.*');
     $q->from('miembro_celula mc inner join celula c on c.id = mc.celula_id inner join sf_guard_user d on mc.discipulo_id = d.id');
     $q->where('c.discipulo_lider_id = ? OR d.tipo_discipulo = ?', array($id_lider, 4));
     $q->andWhere('d.genero = ?', $genero);
     $q->addComponent('d', 'Discipulo d');
     //        $q->orWhere('d.tipo_discipulo = ?', 4);
     return $q->execute();
 }
示例#2
0
 public function executeRecentUpdates()
 {
     $q = new Doctrine_RawSql();
     $q->select('{e.*}, {i.*}, {u.*}, {p.*}')->from('entity e LEFT JOIN image i ON (e.id = i.entity_id AND i.is_deleted = 0) LEFT JOIN sf_guard_user u ON (u.id = e.last_user_id) LEFT JOIN sf_guard_user_profile p ON (u.id = p.user_id)')->where('e.is_deleted IS NULL OR e.is_deleted = ?', false)->addComponent('e', 'Entity e')->addComponent('i', 'e.Image i')->addComponent('u', 'e.LastUser u')->addComponent('p', 'u.Profile p')->orderBy('e.updated_at DESC')->limit(@$this->limit ? $this->limit : 10);
     if (@$this->group) {
         if (count($userIds = $this->group->getUserIds())) {
             $q->andWhereIn('e.last_user_id', $userIds);
             if (count($entityIds = $this->group->getEntityIds())) {
                 $q->andWhereIn('e.id', $entityIds);
             }
         } else {
             $q->andWhere('1=0');
         }
     }
     if ($this->network) {
         $q->leftJoin('ls_list_entity le ON (e.id = le.entity_id)')->addComponent('le', 'e.LsListEntity le')->andWhere('le.list_id = ?', $this->network['id']);
     }
     $this->entities = $q->execute();
 }