public function getFeedbackEntities(array $options) : array
 {
     $options = array_merge(['profileId' => null, 'seek' => ['offset' => 0, 'limit' => self::DEFAULT_LIMIT], 'filter' => ['read' => null, 'answer' => null]], $options);
     $seek = new Seek(self::MAX_LIMIT, $options['seek']['offset'], $options['seek']['limit']);
     $qb = $this->createQueryBuilder('f');
     $qb->setFirstResult($seek->getOffset());
     $qb->setMaxResults($seek->getLimit());
     if ($options['profileId']) {
         $qb->andWhere($qb->expr()->eq('f.profile', (int) $options['profileId']));
     }
     if (isset($options['filter']['read'])) {
         $qb->andWhere($qb->expr()->eq('f.read', (int) $options['filter']['read']));
     }
     if (isset($options['filter']['answer'])) {
         if ($options['filter']['answer']) {
             $qb->andWhere('f.response IS NOT NULL');
         } else {
             $qb->andWhere('f.response IS NULL');
         }
     }
     return $qb->getQuery()->execute();
 }
Beispiel #2
0
 public function listSubscribedCommunities(Profile $profile, Seek $seek) : array
 {
     return $this->subscribeRepository->findBy(['profileId' => $profile->getId(), 'subscribeType' => Subscribe::TYPE_COMMUNITY], ['id' => 'DESC'], $seek->getLimit(), $seek->getOffset());
 }