page; } /** * @param int $page * @return $this */ public function setPage($page) { $this->page = (int) $page; return $this; } /** * @return int */ public function getPageSize() { return $this->pageSize; } /** * @param int $pageSize * @return $this */ public function setPageSize($pageSize) { if (!empty($pageSize) && (int) $pageSize > 0) { $this->pageSize = (int) $pageSize; } return $this; } /** * @return string */ public function getOrderBy() { return $this->orderBy; } /** * You need to validate carefully if this value is used from a user-input. * * @param string $orderBy * @return $this */ public function setOrderBy($orderBy) { $this->orderBy = $orderBy; return $this; } /** * @return string */ public function getOrder() { return $this->order; } /** * @param string $order * @return $this */ public function setOrder($order) { if (in_array($order, [self::ORDER_ASC, self::ORDER_DESC])) { $this->order = $order; } return $this; } /** * @return string */ public function getResultType() { return $this->resultType; } /** * @param string $resultType * @return $this * @throws \InvalidArgumentException */ public function setResultType(string $resultType) { $allowed = [self::RESULT_TYPE_PAGER, self::RESULT_TYPE_QUERYBUILDER, self::RESULT_TYPE_OBJECTS]; if (!in_array($resultType, $allowed)) { throw new \InvalidArgumentException('Unsupported query result type'); } $this->resultType = $resultType; return $this; } /** * @return object */ public function getHiddenEntity() { return $this->hiddenEntity; } /** * @param object $hiddenEntity * @return BaseQuery */ public function setHiddenEntity($hiddenEntity) { $this->hiddenEntity = $hiddenEntity; return $this; } }