/** * Prepares and returns Doctrine's QueryBuilder * * @param ColumnCollection $columns * @param DataSetRequestInterface $request * * @return \Doctrine\ORM\QueryBuilder */ public function getQueryBuilder(ColumnCollection $columns, DataSetRequestInterface $request) { $this->conditions = $request->getConditions(); $queryBuilder = $this->repository->getDataSetQueryBuilder(); $queryBuilder->select($columns->getSelectClause()); $queryBuilder->addOrderBy($this->getOrderByExpression($request, $columns)); $queryBuilder->setFirstResult($request->getOffset()); $this->setColumnConditions($queryBuilder, $columns); if ($request->getLimit() > 0) { $queryBuilder->setMaxResults($request->getLimit()); } return $queryBuilder; }
/** * Returns the query conditions * * @param DataSetRequestInterface $request * * @return ConditionsCollection */ private function getConditions(DataSetRequestInterface $request) : ConditionsCollection { return $request->getConditions(); }