You are here

public function Sort::__construct in JSON:API 8

Same name and namespace in other branches
  1. 8.2 src/Query/Sort.php \Drupal\jsonapi\Query\Sort::__construct()

Constructs a new Sort object.

Takes an array of sort fields. Example: [ [ 'path' => 'changed', 'direction' => 'DESC', ], [ 'path' => 'title', 'direction' => 'ASC', 'langcode' => 'en-US', ], ]

Parameters

array $fields: The the entity query sort fields.

File

src/Query/Sort.php, line 66

Class

Sort
Gathers information about the sort parameter.

Namespace

Drupal\jsonapi\Query

Code

public function __construct(array $fields) {
  $this->fields = $fields;
}