forked from ezsystems/ezplatform-kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHandler.php
More file actions
260 lines (234 loc) · 8.99 KB
/
Handler.php
File metadata and controls
260 lines (234 loc) · 8.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<?php
/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Publish\SPI\Persistence\Content\Location;
use eZ\Publish\SPI\Persistence\Content\Location;
/**
* The Location Handler interface defines operations on Location elements in the storage engine.
*/
interface Handler
{
/**
* Loads the data for the location identified by $locationId.
*
* @param int $locationId
* @param string[]|null $translations If set, NotFound is thrown if content is not in given translation.
* @param bool $useAlwaysAvailable Respect always available flag on content, where main language is valid translation fallback.
*
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException
*
* @return \eZ\Publish\SPI\Persistence\Content\Location
*/
public function load($locationId, array $translations = null, bool $useAlwaysAvailable = true);
/**
* Return list of unique Locations, with location id as key.
*
* Missing items (NotFound) will be missing from the array and not cause an exception, it's up
* to calling logic to determine if this should cause exception or not.
*
* @param int[] $locationIds
* @param string[]|null $translations If set, only locations with content in given translations are returned.
* @param bool $useAlwaysAvailable Respect always available flag on content, where main language is valid translation fallback.
*
* @return \eZ\Publish\SPI\Persistence\Content\Location[]|iterable
*/
public function loadList(array $locationIds, array $translations = null, bool $useAlwaysAvailable = true): iterable;
/**
* Loads the subtree ids of the location identified by $locationId.
*
* @param int $locationId
*
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException
*
* @return array Location ids are in the index, Content ids in the value.
*/
public function loadSubtreeIds($locationId);
/**
* Loads the data for the location identified by $remoteId.
*
* @param string $remoteId
* @param string[]|null $translations If set, NotFound is thrown if content is not in given translation.
* @param bool $useAlwaysAvailable Respect always available flag on content, where main language is valid translation fallback.
*
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException
*
* @return \eZ\Publish\SPI\Persistence\Content\Location
*/
public function loadByRemoteId($remoteId, array $translations = null, bool $useAlwaysAvailable = true);
/**
* Loads all locations for $contentId, optionally limited to a sub tree
* identified by $rootLocationId.
*
* @param int $contentId
* @param int $rootLocationId
*
* @return \eZ\Publish\SPI\Persistence\Content\Location[]
*/
public function loadLocationsByContent($contentId, $rootLocationId = null);
/**
* Loads all locations for $contentId in trash, optionally limited to a sub tree
* identified by $rootLocationId.
*
* @return \eZ\Publish\SPI\Persistence\Content\Location[]
*/
public function loadLocationsByTrashContent(int $contentId, ?int $rootLocationId = null): array;
/**
* Loads all parent Locations for unpublished Content by given $contentId.
*
*
* @param mixed $contentId
*
* @return \eZ\Publish\SPI\Persistence\Content\Location[]
*/
public function loadParentLocationsForDraftContent($contentId);
/**
* Copy location object identified by $sourceId, into destination identified by $destinationParentId.
*
* Performs a deep copy of the location identified by $sourceId and all of
* its child locations, copying the most recent published content object
* for each location to a new content object without any additional version
* information. Relations for published version are copied. URLs are not touched at all.
*
* @param mixed $sourceId
* @param mixed $destinationParentId
*
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If $sourceId or $destinationParentId are invalid
*
* @return \eZ\Publish\SPI\Persistence\Content\Location the newly created Location.
*/
public function copySubtree($sourceId, $destinationParentId);
public function getSubtreeSize(string $path, ?int $limit = null): int;
/**
* Moves location identified by $sourceId into new parent identified by $destinationParentId.
*
* Performs a full move of the location identified by $sourceId to a new
* destination, identified by $destinationParentId. Relations do not need
* to be updated, since they refer to Content. URLs are not touched.
*
* @param mixed $sourceId
* @param mixed $destinationParentId
*
* @return bool
*/
public function move($sourceId, $destinationParentId);
/**
* Marks the given nodes and all ancestors as modified.
*
* Optionally a time stamp with the modification date may be specified,
* otherwise the current time is used.
*
* @deprecated As of 6.8, not been used by repository since 5.x.
*
* @param int|string $locationId
* @param int $timestamp
*/
public function markSubtreeModified($locationId, $timestamp = null);
/**
* Sets a location to be hidden, and it self + all children to invisible.
*
* @param mixed $id Location ID
*/
public function hide($id);
/**
* Sets a location to be unhidden, and self + children to visible unless a parent is hiding the tree.
* If not make sure only children down to first hidden node is marked visible.
*
* @param mixed $id
*/
public function unHide($id);
/**
* Sets a location + all children to invisible.
*
* @param int $id Location ID
*/
public function setInvisible(int $id): void;
/**
* Sets a location + all children to visible.
*
* @param int $id Location ID
*/
public function setVisible(int $id): void;
/**
* Swaps the content object being pointed to by a location object.
*
* Make the location identified by $locationId1 refer to the Content
* referred to by $locationId2 and vice versa.
*
* @param mixed $locationId1
* @param mixed $locationId2
*
* @return bool
*/
public function swap($locationId1, $locationId2);
/**
* Updates an existing location.
*
* @param \eZ\Publish\SPI\Persistence\Content\Location\UpdateStruct $location
* @param int $locationId
*/
public function update(UpdateStruct $location, $locationId);
/**
* Creates a new location rooted at $location->parentId.
*
* @param \eZ\Publish\SPI\Persistence\Content\Location\CreateStruct $location
*
* @return \eZ\Publish\SPI\Persistence\Content\Location
*
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if parent Location does not exist
*/
public function create(CreateStruct $location);
/**
* Removes all Locations under and including $locationId.
*
* Performs a recursive delete on the location identified by $locationId,
* including all of its child locations. Content which is not referred to
* by any other location is automatically removed. Content which looses its
* main Location will get the first of its other Locations assigned as the
* new main Location.
*
* @param mixed $locationId
*
* @return bool
*/
public function removeSubtree($locationId);
/**
* Set section on all content objects in the subtree.
* Only main locations will be updated.
*
* @todo This can be confusing (regarding permissions and main/multi location).
* So method is for the time being not in PublicAPI so people can instead
* write scripts using their own logic against the assignSectionToContent() api.
*
* @param mixed $locationId
* @param mixed $sectionId
*/
public function setSectionForSubtree($locationId, $sectionId);
/**
* Changes main location of content identified by given $contentId to location identified by given $locationId.
*
* @param mixed $contentId
* @param mixed $locationId
*/
public function changeMainLocation($contentId, $locationId);
/**
* Get the total number of all existing Locations. Can be combined with loadAllLocations.
*
* @return int
*/
public function countAllLocations();
/**
* Bulk-load all existing Locations, constrained by $limit and $offset to paginate results.
*
* @param int $offset
* @param int $limit
*
* @return \eZ\Publish\SPI\Persistence\Content\Location[]
*/
public function loadAllLocations($offset, $limit);
/**
* Counts locations for a given content represented by its id.
*/
public function countLocationsByContent(int $contentId): int;
}