getEntityManager() ->createQueryBuilder() ->select("si") ->from(ScheduleCalendarSyncInfo::class, "si") ->join('si.summit_event', 'e', Join::WITH, " e.id = :event_id") ->join('si.calendar_sync_info', 'ci', Join::WITH, " ci.revoked = :credential_status") ->orderBy('si.id', 'ASC') ->setParameter('event_id', $summit_event->getId()) ->setParameter('credential_status',false); $query= $query ->setFirstResult($paging_info->getOffset()) ->setMaxResults($paging_info->getPerPage()); $paginator = new Paginator($query, $fetchJoinCollection = true); $total = $paginator->count(); $data = []; foreach($paginator as $entity) $data[] = $entity; return new PagingResponse ( $total, $paging_info->getPerPage(), $paging_info->getCurrentPage(), $paging_info->getLastPage($total), $data ); } /** * @param SummitAbstractLocation $location * @param PagingInfo $paging_info * @return PagingResponse */ public function getAllBySummitLocation(SummitAbstractLocation $location, PagingInfo $paging_info) { $query = $this->getEntityManager() ->createQueryBuilder() ->select("si") ->from(ScheduleCalendarSyncInfo::class, "si") ->join('si.location', 'l', Join::WITH, " l.id = :location_id") ->join('si.calendar_sync_info', 'ci', Join::WITH, " ci.revoked = :crendential_status") ->orderBy('si.id', 'ASC') ->setParameter('location_id', $location->getId()) ->setParameter('crendential_status',false); $query= $query ->setFirstResult($paging_info->getOffset()) ->setMaxResults($paging_info->getPerPage()); $paginator = new Paginator($query, $fetchJoinCollection = true); $total = $paginator->count(); $data = []; foreach($paginator as $entity) $data[] = $entity; return new PagingResponse ( $total, $paging_info->getPerPage(), $paging_info->getCurrentPage(), $paging_info->getLastPage($total), $data ); } }