Class

eZ\Publish\API\Repository\Values\Content\Query\SortClause\Field

class Field extends SortClause implements CustomFieldInterface

Sets sort direction on a field value for a content query.

Note: for fields of some field types order will vary per search engine. This comes from the different way of storing IDs in the search backend, and therefore relates to the field types that store ID value for sorting (Relation field type). For Legacy search engine IDs are stored as integers, while with Solr and Elasticsearch engines they are stored as strings. In that case the difference will be basically the one between numerical and alphabetical order of sorting.

This reflects API definition of IDs as mixed type (integer or string).

Properties

string $direction Sort direction One of Query::SORTASC or Query::SORTDESC;.
string $target Sort target, high level: sectionidentifier, attributevalue, etc.
Target $targetData Extra target data, required by some sort clauses, field for instance.

Methods

__construct(string $typeIdentifier, string $fieldIdentifier, string $sortDirection = Query::SORT_ASC)

Constructs a new Field SortClause on Type $typeIdentifier and Field $fieldIdentifier.

setCustomField(string $type, string $field, string $customField)

Set a custom field to sort by.

mixed getCustomField(string $type, string $field)

Return custom field.

Details

at line 43
public __construct(string $typeIdentifier, string $fieldIdentifier, string $sortDirection = Query::SORT_ASC)

Constructs a new Field SortClause on Type $typeIdentifier and Field $fieldIdentifier.

Parameters

string $typeIdentifier
string $fieldIdentifier
string $sortDirection one of Query::SORTASC or Query::SORTDESC

at line 61
public setCustomField(string $type, string $field, string $customField)

Set a custom field to sort by.

Set a custom field to sort by for a defined field in a defined type.

Parameters

string $type
string $field
string $customField

at line 76
public mixed getCustomField(string $type, string $field)

Return custom field.

If no custom field is set, return null

Parameters

string $type
string $field

Return Value

mixed If no custom field is set, return null