highlight invisible items (#2493)
This commit is contained in:
@@ -24,6 +24,7 @@ class BaseQuery
|
||||
public const ORDER_DESC = 'DESC';
|
||||
|
||||
public const DEFAULT_PAGESIZE = 50;
|
||||
/** @deprecated since 1.14 */
|
||||
public const DEFAULT_PAGE = 1;
|
||||
|
||||
/**
|
||||
@@ -40,7 +41,7 @@ class BaseQuery
|
||||
public const RESULT_TYPE_QUERYBUILDER = 'QueryBuilder';
|
||||
|
||||
private $defaults = [
|
||||
'page' => self::DEFAULT_PAGE,
|
||||
'page' => 1,
|
||||
'pageSize' => self::DEFAULT_PAGESIZE,
|
||||
'orderBy' => 'id',
|
||||
'order' => self::ORDER_ASC,
|
||||
@@ -49,7 +50,7 @@ class BaseQuery
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $page = self::DEFAULT_PAGE;
|
||||
private $page = 1;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
@@ -62,6 +63,10 @@ class BaseQuery
|
||||
* @var string
|
||||
*/
|
||||
private $order = self::ORDER_ASC;
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private $orderGroups = [];
|
||||
/**
|
||||
* @var string
|
||||
* @deprecated since 1.4, will be removed with 2.0
|
||||
@@ -152,7 +157,9 @@ class BaseQuery
|
||||
*/
|
||||
public function setPage($page)
|
||||
{
|
||||
$this->page = (int) $page;
|
||||
if ($page !== null && (int) $page > 0) {
|
||||
$this->page = (int) $page;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -180,13 +187,7 @@ class BaseQuery
|
||||
return $this->orderBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* You need to validate carefully if this value is used from a user-input.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @return self
|
||||
*/
|
||||
public function setOrderBy($orderBy)
|
||||
public function setOrderBy(string $orderBy): self
|
||||
{
|
||||
$this->orderBy = $orderBy;
|
||||
|
||||
@@ -198,11 +199,7 @@ class BaseQuery
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $order
|
||||
* @return self
|
||||
*/
|
||||
public function setOrder($order)
|
||||
public function setOrder(string $order): self
|
||||
{
|
||||
if (\in_array($order, [self::ORDER_ASC, self::ORDER_DESC])) {
|
||||
$this->order = $order;
|
||||
@@ -211,6 +208,20 @@ class BaseQuery
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addOrderGroup(string $orderBy, string $order): void
|
||||
{
|
||||
$this->orderGroups[$orderBy] = $order;
|
||||
}
|
||||
|
||||
public function getOrderGroups(): array
|
||||
{
|
||||
if (empty($this->orderGroups)) {
|
||||
return [$this->orderBy => $this->order];
|
||||
}
|
||||
|
||||
return $this->orderGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.0
|
||||
* @return string
|
||||
|
||||
Reference in New Issue
Block a user