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

API/Repository/Values/Content/Location.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\API\Repository\Values\Content;
8
9 use eZ\Publish\API\Repository\Exceptions\NotImplementedException;
10 use eZ\Publish\API\Repository\Values\ValueObject;
11 use eZ\Publish\API\Repository\Values\Content\Query\SortClause;
12
31 abstract class Location extends ValueObject
32 {
33 // @todo Rename these to better fit current naming, also reuse these in Persistence or copy the change over.
34 const SORT_FIELD_PATH = 1;
35 const SORT_FIELD_PUBLISHED = 2;
36 const SORT_FIELD_MODIFIED = 3;
37 const SORT_FIELD_SECTION = 4;
38 const SORT_FIELD_DEPTH = 5;
39 const SORT_FIELD_CLASS_IDENTIFIER = 6;
40 const SORT_FIELD_CLASS_NAME = 7;
41 const SORT_FIELD_PRIORITY = 8;
42 const SORT_FIELD_NAME = 9;
43
47 const SORT_FIELD_MODIFIED_SUBNODE = 10;
48
49 const SORT_FIELD_NODE_ID = 11;
50 const SORT_FIELD_CONTENTOBJECT_ID = 12;
51
52 const SORT_ORDER_DESC = 0;
53 const SORT_ORDER_ASC = 1;
54
55 const STATUS_DRAFT = 0;
56 const STATUS_PUBLISHED = 1;
57
64 const SORT_FIELD_MAP = [
65 self::SORT_FIELD_PATH => SortClause\Location\Path::class,
66 self::SORT_FIELD_PUBLISHED => SortClause\DatePublished::class,
67 self::SORT_FIELD_MODIFIED => SortClause\DateModified::class,
68 self::SORT_FIELD_SECTION => SortClause\SectionIdentifier::class,
69 self::SORT_FIELD_DEPTH => SortClause\Location\Depth::class,
70 //self::SORT_FIELD_CLASS_IDENTIFIER => false,
71 //self::SORT_FIELD_CLASS_NAME => false,
72 self::SORT_FIELD_PRIORITY => SortClause\Location\Priority::class,
73 self::SORT_FIELD_NAME => SortClause\ContentName::class,
74 //self::SORT_FIELD_MODIFIED_SUBNODE => false,
75 self::SORT_FIELD_NODE_ID => SortClause\Location\Id::class,
76 self::SORT_FIELD_CONTENTOBJECT_ID => SortClause\ContentId::class,
77 ];
78
82 const SORT_ORDER_MAP = [
83 self::SORT_ORDER_DESC => Query::SORT_DESC,
84 self::SORT_ORDER_ASC => Query::SORT_ASC,
85 ];
86
92 protected $id;
93
102 public $status = self::STATUS_PUBLISHED;
103
112 protected $priority;
113
119 protected $hidden;
120
127 protected $invisible;
128
134 protected $explicitlyHidden;
135
143 protected $remoteId;
144
150 abstract public function getContentInfo();
151
157 public function isDraft()
158 {
159 return $this->status === self::STATUS_DRAFT;
160 }
161
167 protected $parentLocationId;
168
174 protected $pathString;
175
181 protected $depth;
182
190 protected $sortField;
191
199 protected $sortOrder;
200
202 protected $content;
203
207 public function getContent(): Content
208 {
209 return $this->content;
210 }
211
219 public function getSortClauses()
220 {
221 $map = self::SORT_FIELD_MAP;
222 if (!isset($map[$this->sortField])) {
223 throw new NotImplementedException(
224 "Sort clause not implemented for Location sort field with value {$this->sortField}"
225 );
226 }
227
228 $sortClause = new $map[$this->sortField]();
229 $sortClause->direction = self::SORT_ORDER_MAP[$this->sortOrder];
230
231 return [$sortClause];
232 }
233 }
eZ\Publish\API\Repository\Exceptions\NotImplementedException
This Exception is thrown if a feature has not been implemented intentionally.
Definition: API/Repository/Exceptions/NotImplementedException.php:15
eZ\Publish\API\Repository\Values\Content\Content
Definition: Publish/API/Repository/Values/Content/Content.php:21
eZ\Publish\API\Repository\Values\Content\Location
Definition: API/Repository/Values/Content/Location.php:32
eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_MODIFIED
const SORT_FIELD_MODIFIED
Definition: API/Repository/Values/Content/Location.php:36
eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_CLASS_NAME
const SORT_FIELD_CLASS_NAME
Definition: API/Repository/Values/Content/Location.php:40
eZ\Publish\API\Repository\Values\Content\Location\$sortField
$sortField
Definition: API/Repository/Values/Content/Location.php:190
eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_MODIFIED_SUBNODE
const SORT_FIELD_MODIFIED_SUBNODE
Definition: API/Repository/Values/Content/Location.php:47
eZ\Publish\API\Repository\Values\Content\Location\$invisible
$invisible
Definition: API/Repository/Values/Content/Location.php:127
eZ\Publish\API\Repository\Values\Content\Location\$id
$id
Definition: API/Repository/Values/Content/Location.php:92
eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_MAP
const SORT_FIELD_MAP
Map for Location sort fields to their respective SortClauses.
Definition: API/Repository/Values/Content/Location.php:64
eZ\Publish\API\Repository\Values\Content\Location\STATUS_DRAFT
const STATUS_DRAFT
Definition: API/Repository/Values/Content/Location.php:55
eZ\Publish\API\Repository\Values\Content\Location\$status
$status
Definition: API/Repository/Values/Content/Location.php:102
eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_DEPTH
const SORT_FIELD_DEPTH
Definition: API/Repository/Values/Content/Location.php:38
eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_PATH
const SORT_FIELD_PATH
Definition: API/Repository/Values/Content/Location.php:34
eZ\Publish\API\Repository\Values\Content\Location\$explicitlyHidden
$explicitlyHidden
Definition: API/Repository/Values/Content/Location.php:134
eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_CONTENTOBJECT_ID
const SORT_FIELD_CONTENTOBJECT_ID
Definition: API/Repository/Values/Content/Location.php:50
eZ\Publish\API\Repository\Values\Content\Location\$content
$content
Definition: API/Repository/Values/Content/Location.php:202
eZ\Publish\API\Repository\Values\Content\Location\STATUS_PUBLISHED
const STATUS_PUBLISHED
Definition: API/Repository/Values/Content/Location.php:56
eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_SECTION
const SORT_FIELD_SECTION
Definition: API/Repository/Values/Content/Location.php:37
eZ\Publish\API\Repository\Values\Content\Location\SORT_ORDER_DESC
const SORT_ORDER_DESC
Definition: API/Repository/Values/Content/Location.php:52
eZ\Publish\API\Repository\Values\Content\Location\$depth
$depth
Definition: API/Repository/Values/Content/Location.php:181
eZ\Publish\API\Repository\Values\Content\Location\$pathString
$pathString
Definition: API/Repository/Values/Content/Location.php:174
eZ\Publish\API\Repository\Values\Content\Location\getContentInfo
getContentInfo()
Returns the content info of the content object of this location.
eZ\Publish\API\Repository\Values\Content\Location\getSortClauses
getSortClauses()
Get SortClause objects built from Locations's sort options.
Definition: API/Repository/Values/Content/Location.php:219
eZ\Publish\API\Repository\Values\Content\Location\isDraft
isDraft()
Returns true if current location is a draft.
Definition: API/Repository/Values/Content/Location.php:157
eZ\Publish\API\Repository\Values\Content\Location\SORT_ORDER_ASC
const SORT_ORDER_ASC
Definition: API/Repository/Values/Content/Location.php:53
eZ\Publish\API\Repository\Values\Content\Location\$remoteId
$remoteId
Definition: API/Repository/Values/Content/Location.php:143
eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_PRIORITY
const SORT_FIELD_PRIORITY
Definition: API/Repository/Values/Content/Location.php:41
eZ\Publish\API\Repository\Values\Content\Location\SORT_ORDER_MAP
const SORT_ORDER_MAP
Map for Location sort order to their respective Query SORT constants.
Definition: API/Repository/Values/Content/Location.php:82
eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_PUBLISHED
const SORT_FIELD_PUBLISHED
Definition: API/Repository/Values/Content/Location.php:35
eZ\Publish\API\Repository\Values\Content\Location\$priority
$priority
Definition: API/Repository/Values/Content/Location.php:112
eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_CLASS_IDENTIFIER
const SORT_FIELD_CLASS_IDENTIFIER
Definition: API/Repository/Values/Content/Location.php:39
eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_NAME
const SORT_FIELD_NAME
Definition: API/Repository/Values/Content/Location.php:42
eZ\Publish\API\Repository\Values\Content\Location\$hidden
$hidden
Definition: API/Repository/Values/Content/Location.php:119
eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_NODE_ID
const SORT_FIELD_NODE_ID
Definition: API/Repository/Values/Content/Location.php:49
eZ\Publish\API\Repository\Values\Content\Location\$sortOrder
$sortOrder
Definition: API/Repository/Values/Content/Location.php:199
eZ\Publish\API\Repository\Values\Content\Location\getContent
getContent()
Definition: API/Repository/Values/Content/Location.php:207
eZ\Publish\API\Repository\Values\Content\Location\$parentLocationId
$parentLocationId
Definition: API/Repository/Values/Content/Location.php:167
eZ\Publish\API\Repository\Values\Content\Query\SORT_DESC
const SORT_DESC
Definition: API/Repository/Values/Content/Query.php:18
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\ValueObject
Definition: API/Repository/Values/ValueObject.php:21
eZ\Publish\API\Repository\Values\Content\Query\SortClause
Definition: API/Repository/Values/Content/Query/SortClause/ContentId.php:7
eZ\Publish\API\Repository\Values\Content
Definition: Publish/API/Repository/Values/Content/Content.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.