コード例 #1
0
 /**
  * @param GetOrganizationListRequest $request
  *
  * @return Criteria
  */
 private function buildCriteria($request)
 {
     $criteria = new Criteria();
     $field = new OrganizationField(OrganizationField::NAME);
     $fieldFilter = new FieldFilter($field, FieldFilter::OPERATION_LIKE, '%' . $request->organizationName() . '%');
     return $criteria->addFieldFilter($fieldFilter)->setPage($request->page());
 }
コード例 #2
0
 /**
  * @param Criteria $criteria
  *
  * @return EntityRepositoryResult
  */
 public function findByCriteria(Criteria $criteria)
 {
     return new EntityRepositoryResult($this->entities, $criteria->page(), count($this->entities), $criteria->rowsPerPage(), ceil(count($this->entities) / $criteria->rowsPerPage()));
 }
コード例 #3
0
 /**
  * @param Paginator $paginator
  * @param Criteria  $criteria
  *
  * @return mixed
  */
 private function getPageResult(Paginator $paginator, Criteria $criteria)
 {
     return $paginator->getQuery()->setFirstResult($criteria->rowsPerPage() * ($criteria->page() - 1))->setMaxResults($criteria->rowsPerPage())->getResult();
 }