Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

API/Repository/Values/Content/Query/SortClause/Field.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\API\Repository\Values\Content\Query\SortClause;
8
9 use eZ\Publish\API\Repository\Values\Content\Query\SortClause\Target\FieldTarget;
10 use eZ\Publish\API\Repository\Values\Content\Query;
11 use eZ\Publish\API\Repository\Values\Content\Query\SortClause;
12 use eZ\Publish\API\Repository\Values\Content\Query\CustomFieldInterface;
13
25 class Field extends SortClause implements CustomFieldInterface
26 {
32 protected $customFields = [];
33
41 public function __construct($typeIdentifier, $fieldIdentifier, $sortDirection = Query::SORT_ASC)
42 {
43 parent::__construct(
44 'field',
45 $sortDirection,
46 new FieldTarget($typeIdentifier, $fieldIdentifier)
47 );
48 }
49
59 public function setCustomField($type, $field, $customField)
60 {
61 $this->customFields[$type][$field] = $customField;
62 }
63
74 public function getCustomField($type, $field)
75 {
76 if (!isset($this->customFields[$type][$field])) {
77 return null;
78 }
79
80 return $this->customFields[$type][$field];
81 }
82 }
eZ\Publish\API\Repository\Values\Content\Query\SortClause\Field
Sets sort direction on a field value for a content query.
Definition: API/Repository/Values/Content/Query/SortClause/Field.php:26
eZ\Publish\API\Repository\Values\Content\Query\SortClause\Field\__construct
__construct($typeIdentifier, $fieldIdentifier, $sortDirection=Query::SORT_ASC)
Constructs a new Field SortClause on Type $typeIdentifier and Field $fieldIdentifier.
Definition: API/Repository/Values/Content/Query/SortClause/Field.php:41
eZ\Publish\API\Repository\Values\Content\Query\SortClause\Field\setCustomField
setCustomField($type, $field, $customField)
Set a custom field to sort by.
Definition: API/Repository/Values/Content/Query/SortClause/Field.php:59
eZ\Publish\API\Repository\Values\Content\Query\SortClause\Field\getCustomField
getCustomField($type, $field)
Return custom field.
Definition: API/Repository/Values/Content/Query/SortClause/Field.php:74
eZ\Publish\API\Repository\Values\Content\Query\SortClause\Field\$customFields
$customFields
Definition: API/Repository/Values/Content/Query/SortClause/Field.php:32
eZ\Publish\API\Repository\Values\Content\Query\SortClause\Target\FieldTarget
Struct that stores extra target informations for a SortClause object.
Definition: FieldTarget.php:15
eZ\Publish\API\Repository\Values\Content\Query\SortClause
This class is the base for SortClause classes, used to set sorting of content queries.
Definition: Content/Query/SortClause.php:16
eZ\Publish\API\Repository\Values\Content\Query
This class is used to perform a Content query.
Definition: API/Repository/Values/Content/Query.php:15
eZ\Publish\API\Repository\Values\Content\Query\SORT_ASC
const SORT_ASC
Definition: API/Repository/Values/Content/Query.php:16
eZ\Publish\API\Repository\Values\Content\Query\CustomFieldInterface
Interface for criteria and sort clauses, which defines a custom field mapping.
Definition: CustomFieldInterface.php:18
eZ\Publish\API\Repository\Values\Content\Query\SortClause
Definition: API/Repository/Values/Content/Query/SortClause/ContentId.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.