Ejemplo n.º 1
0
 /**
  * findDemanded
  *
  * @param $demands
  */
 public function findDemanded($demands, $limit)
 {
     $query = $this->createQuery();
     if ($limit) {
         $query->setLimit((int) $limit);
     }
     $constraints = DemandsUtility::getConstraintsForDemand($query, $demands);
     if ($constraints !== null) {
         $query->matching($constraints);
     }
     return $query->execute();
 }
Ejemplo n.º 2
0
 public function findUpcoming($demands = array(), $limit = 0, $returnRawQueryResult = false)
 {
     $query = $this->createQuery();
     /* Our EventDates are not localizable. Only the Event's are. So lets ignore the sys language flag.
      * This is actually needed so that extbase does not create sql queries that try to find direct
      * relations betweens translated Events and EventDates (as the relation between EventDate and Event
      * can only be established in the default language) */
     $query->getQuerySettings()->setRespectSysLanguage(false);
     $constraints = array($query->greaterThan('start', new \DateTime('NOW')), $query->equals('frequency', 0));
     $additional = DemandsUtility::getConstraintsForDemand($query, $demands);
     if ($additional !== null) {
         $constraints[] = $additional;
     }
     $query->matching($query->logicalAnd($constraints));
     if ($limit) {
         $query->setLimit((int) $limit);
     }
     return $query->execute($returnRawQueryResult);
 }