Class SortField
Represents a sort field configuration for pagination.
Namespace: Cake\Datasource\Paging
Constants
Method Summary
-
__construct() public
Constructor.
-
asc() public static
Create a sort field with ascending default direction.
-
desc() public static
Create a sort field with descending default direction.
-
getDirection() public
Get the sort direction to use.
-
getField() public
Get the field name.
-
isLocked() public
Check if the sort direction is locked.
Method Detail
__construct() ¶ public
__construct(string $field, string|null $defaultDirection = null, bool $locked = false)
Constructor.
Parameters
-
string$field The field name to sort by
-
string|null$defaultDirection optional The default sort direction
-
bool$locked optional Whether the sort direction is locked
asc() ¶ public static
asc(string $field, bool $locked = false): self
Create a sort field with ascending default direction.
Parameters
-
string$field The field name to sort by
-
bool$locked optional Whether the sort direction is locked
Returns
selfdesc() ¶ public static
desc(string $field, bool $locked = false): self
Create a sort field with descending default direction.
Parameters
-
string$field The field name to sort by
-
bool$locked optional Whether the sort direction is locked
Returns
selfgetDirection() ¶ public
getDirection(string $requestedDirection, bool $directionSpecified): string
Get the sort direction to use.
Parameters
-
string$requestedDirection The direction requested by the user
-
bool$directionSpecified Whether a direction was explicitly specified
Returns
string