CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 5.3 Chiffon API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 5.3
      • 5.3
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
      • Exception
      • Locator
      • Paging
        • Exception
    • Error
    • Event
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • TestSuite
    • Utility
    • Validation
    • View

Class SortField

Represents a sort field configuration for pagination.

Namespace: Cake\Datasource\Paging

Constants

  • string
    ASC ¶
    'asc'

    Ascending sort direction

  • string
    DESC ¶
    'desc'

    Descending sort direction

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
self

desc() ¶ 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
self

getDirection() ¶ 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

getField() ¶ public

getField(): string

Get the field name.

Returns
string

isLocked() ¶ public

isLocked(): bool

Check if the sort direction is locked.

Returns
bool
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs