Ejemplo n.º 1
0
 /**
  * Returns the whole aggregated feed. You can limit the list giving any number.
  *
  * @return List<UnifiedSocialEntityInterface>
  */
 public function getFeed($limit = false)
 {
     if ($limit !== false && is_int($limit)) {
         $this->qb->setMaxResults($limit);
     }
     $this->qb->andWhere('e.approved = 1');
     return $this->qb->getQuery()->getResult();
 }
Ejemplo n.º 2
0
 /**
  * @TODO GROUP_CONCAT()
  * Add a join statement from array collection
  *
  * @param $meta - getClassMetaData
  * @param $fk
  * @param $field
  * @param $alias
  * @param $defaultAlias
  * @param $targetEntity
  */
 public function fkArrayAssociation($meta, $fk, $field, $alias, $defaultAlias, $targetEntity)
 {
     if ($association = $meta->associationMappings[$fk]) {
         if (!in_array($targetEntity, $this->entitys)) {
             $condition = $this->getFullFieldName($association['fieldName'], $alias) . ' = ' . $this->getFullFieldName($association['joinColumns'][0]['referencedColumnName'], $defaultAlias);
             $this->queryBuilder->join($targetEntity, $alias, 'WITH', $condition);
             $this->queryBuilder->andWhere($condition);
             $this->entitys[] = $targetEntity;
         }
         return '(' . $this->getFullFieldName($field, $alias) . ') AS ' . $this->getFullFieldName($field, $alias, '_');
     }
 }
Ejemplo n.º 3
0
 /**
  * Returns the whole aggregated feed. You can limit the list giving any number.
  *
  * @param bool  $onlyApproved if only approved elements should be returned. default is true.
  * @param int   $limit        how many items should be fetched at maximum
  * @param array $requestIds   which requestIds should be fetched, if left empty all are fetched
  * @return array<TwitterEntityInterface> List of twitter entities
  */
 public function getFeed($onlyApproved = true, $limit = false, array $requestIds = array())
 {
     $result = array();
     foreach ($this->apiRequests as $request) {
         if (count($requestIds) > 0 && !in_array($request->getId(), $requestIds)) {
             continue;
         }
         $this->initializeQueryBuilder($request->getId());
         if ($limit !== false && is_int($limit)) {
             $this->qb->setMaxResults($limit);
         }
         if ($onlyApproved) {
             $this->qb->andWhere('e.approved = true');
         }
         $this->qb->andWhere('e.requestId = :requestId')->setParameter('requestId', $request->getId());
         $result = array_merge($result, $this->qb->getQuery()->getResult());
     }
     return $result;
 }
 /**
  * @param $predicates
  */
 public function andWhere($predicates)
 {
     $this->_query->andWhere($predicates);
     $this->_filter['andWhere'][] = $predicates;
 }
Ejemplo n.º 5
0
 /**
  * Add name first letter where condition to query builder
  *
  * @param  Doctrine\ORM\QueryBuilder $qb
  * @param  array                     $letters
  * @return void
  */
 private function addNameRangeWhere($qb, array $letters)
 {
     $orx = $qb->expr()->orx();
     foreach ($letters as $letter) {
         $orx->add($qb->expr()->like('u.username', $qb->expr()->literal(substr($letter, 0, 1) . '%')));
     }
     $qb->andWhere($orx);
 }
Ejemplo n.º 6
0
 /**
  * @param int id
  * @return EntityFinder
  */
 public function whereId($id)
 {
     $this->qb->andWhere("{$this->alias}.id = :id");
     $this->qb->setParameter("id", $id);
     return $this;
 }