1 | <?php |
||
28 | class Handler implements BaseLocationHandler |
||
29 | { |
||
30 | /** |
||
31 | * Gateway for handling location data. |
||
32 | * |
||
33 | * @var \eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway |
||
34 | */ |
||
35 | protected $locationGateway; |
||
36 | |||
37 | /** |
||
38 | * Location locationMapper. |
||
39 | * |
||
40 | * @var \eZ\Publish\Core\Persistence\Legacy\Content\Location\Mapper |
||
41 | */ |
||
42 | protected $locationMapper; |
||
43 | |||
44 | /** |
||
45 | * Content handler. |
||
46 | * |
||
47 | * @var \eZ\Publish\Core\Persistence\Legacy\Content\Handler |
||
48 | */ |
||
49 | protected $contentHandler; |
||
50 | |||
51 | /** |
||
52 | * Object state handler. |
||
53 | * |
||
54 | * @var \eZ\Publish\Core\Persistence\Legacy\Content\ObjectState\Handler |
||
55 | */ |
||
56 | protected $objectStateHandler; |
||
57 | |||
58 | /** |
||
59 | * Tree handler. |
||
60 | * |
||
61 | * @var \eZ\Publish\Core\Persistence\Legacy\Content\TreeHandler |
||
62 | */ |
||
63 | protected $treeHandler; |
||
64 | |||
65 | /** |
||
66 | * Construct from userGateway. |
||
67 | * |
||
68 | * @param \eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway $locationGateway |
||
69 | * @param \eZ\Publish\Core\Persistence\Legacy\Content\Location\Mapper $locationMapper |
||
70 | * @param \eZ\Publish\Core\Persistence\Legacy\Content\Handler $contentHandler |
||
71 | * @param \eZ\Publish\Core\Persistence\Legacy\Content\ObjectState\Handler $objectStateHandler |
||
72 | * @param \eZ\Publish\Core\Persistence\Legacy\Content\TreeHandler $treeHandler |
||
73 | * |
||
74 | * @return \eZ\Publish\Core\Persistence\Legacy\Content\Location\Handler |
||
|
|||
75 | */ |
||
76 | public function __construct( |
||
89 | |||
90 | /** |
||
91 | * Returns parent path string for a path string. |
||
92 | * |
||
93 | * @param string $pathString |
||
94 | * |
||
95 | * @return string |
||
96 | */ |
||
97 | protected function getParentPathString($pathString) |
||
101 | |||
102 | /** |
||
103 | * Loads the data for the location identified by $locationId. |
||
104 | * |
||
105 | * @param int $locationId |
||
106 | * |
||
107 | * @return \eZ\Publish\SPI\Persistence\Content\Location |
||
108 | */ |
||
109 | public function load($locationId) |
||
113 | |||
114 | /** |
||
115 | * Loads the subtree ids of the location identified by $locationId. |
||
116 | * |
||
117 | * @param int $locationId |
||
118 | * |
||
119 | * @return array Location ids are in the index, Content ids in the value. |
||
120 | */ |
||
121 | public function loadSubtreeIds($locationId) |
||
125 | |||
126 | /** |
||
127 | * Loads the data for the location identified by $remoteId. |
||
128 | * |
||
129 | * @param string $remoteId |
||
130 | * |
||
131 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException |
||
132 | * |
||
133 | * @return \eZ\Publish\SPI\Persistence\Content\Location |
||
134 | */ |
||
135 | public function loadByRemoteId($remoteId) |
||
141 | |||
142 | /** |
||
143 | * Loads all locations for $contentId, optionally limited to a sub tree |
||
144 | * identified by $rootLocationId. |
||
145 | * |
||
146 | * @param int $contentId |
||
147 | * @param int $rootLocationId |
||
148 | * |
||
149 | * @return \eZ\Publish\SPI\Persistence\Content\Location[] |
||
150 | */ |
||
151 | public function loadLocationsByContent($contentId, $rootLocationId = null) |
||
157 | |||
158 | /** |
||
159 | * @see \eZ\Publish\SPI\Persistence\Content\Location\Handler::loadParentLocationsForDraftContent |
||
160 | */ |
||
161 | public function loadParentLocationsForDraftContent($contentId) |
||
167 | |||
168 | /** |
||
169 | * Returns an array of default content states with content state group id as key. |
||
170 | * |
||
171 | * @return \eZ\Publish\SPI\Persistence\Content\ObjectState[] |
||
172 | */ |
||
173 | protected function getDefaultContentStates() |
||
187 | |||
188 | /** |
||
189 | * @param Content $content |
||
190 | * @param \eZ\Publish\SPI\Persistence\Content\ObjectState[] $contentStates |
||
191 | */ |
||
192 | protected function setContentStates(Content $content, array $contentStates) |
||
202 | |||
203 | /** |
||
204 | * Copy location object identified by $sourceId, into destination identified by $destinationParentId. |
||
205 | * |
||
206 | * Performs a deep copy of the location identified by $sourceId and all of |
||
207 | * its child locations, copying the most recent published content object |
||
208 | * for each location to a new content object without any additional version |
||
209 | * information. Relations are not copied. URLs are not touched at all. |
||
210 | * |
||
211 | * @todo Either move to async/batch or find ways toward optimizing away operations per object. |
||
212 | * @todo Optionally retain dates and set creator |
||
213 | * |
||
214 | * @param mixed $sourceId |
||
215 | * @param mixed $destinationParentId |
||
216 | * |
||
217 | * @return Location the newly created Location. |
||
218 | */ |
||
219 | public function copySubtree($sourceId, $destinationParentId) |
||
327 | |||
328 | /** |
||
329 | * Moves location identified by $sourceId into new parent identified by $destinationParentId. |
||
330 | * |
||
331 | * Performs a full move of the location identified by $sourceId to a new |
||
332 | * destination, identified by $destinationParentId. Relations do not need |
||
333 | * to be updated, since they refer to Content. URLs are not touched. |
||
334 | * |
||
335 | * @param mixed $sourceId |
||
336 | * @param mixed $destinationParentId |
||
337 | * |
||
338 | * @return bool |
||
339 | */ |
||
340 | public function move($sourceId, $destinationParentId) |
||
357 | |||
358 | /** |
||
359 | * Marks the given nodes and all ancestors as modified. |
||
360 | * |
||
361 | * Optionally a time stamp with the modification date may be specified, |
||
362 | * otherwise the current time is used. |
||
363 | * |
||
364 | * @param int|string $locationId |
||
365 | * @param int $timestamp |
||
366 | */ |
||
367 | public function markSubtreeModified($locationId, $timestamp = null) |
||
373 | |||
374 | /** |
||
375 | * Sets a location to be hidden, and it self + all children to invisible. |
||
376 | * |
||
377 | * @param mixed $id Location ID |
||
378 | */ |
||
379 | public function hide($id) |
||
385 | |||
386 | /** |
||
387 | * Sets a location to be unhidden, and self + children to visible unless a parent is hiding the tree. |
||
388 | * If not make sure only children down to first hidden node is marked visible. |
||
389 | * |
||
390 | * @param mixed $id |
||
391 | */ |
||
392 | public function unHide($id) |
||
398 | |||
399 | /** |
||
400 | * Swaps the content object being pointed to by a location object. |
||
401 | * |
||
402 | * Make the location identified by $locationId1 refer to the Content |
||
403 | * referred to by $locationId2 and vice versa. |
||
404 | * |
||
405 | * @param mixed $locationId1 |
||
406 | * @param mixed $locationId2 |
||
407 | * |
||
408 | * @return bool |
||
409 | */ |
||
410 | public function swap($locationId1, $locationId2) |
||
414 | |||
415 | /** |
||
416 | * Updates an existing location. |
||
417 | * |
||
418 | * @param \eZ\Publish\SPI\Persistence\Content\Location\UpdateStruct $location |
||
419 | * @param int $locationId |
||
420 | */ |
||
421 | public function update(UpdateStruct $location, $locationId) |
||
425 | |||
426 | /** |
||
427 | * Creates a new location rooted at $location->parentId. |
||
428 | * |
||
429 | * @param \eZ\Publish\SPI\Persistence\Content\Location\CreateStruct $createStruct |
||
430 | * |
||
431 | * @return \eZ\Publish\SPI\Persistence\Content\Location |
||
432 | */ |
||
433 | public function create(CreateStruct $createStruct) |
||
445 | |||
446 | /** |
||
447 | * Removes all Locations under and including $locationId. |
||
448 | * |
||
449 | * Performs a recursive delete on the location identified by $locationId, |
||
450 | * including all of its child locations. Content which is not referred to |
||
451 | * by any other location is automatically removed. Content which looses its |
||
452 | * main Location will get the first of its other Locations assigned as the |
||
453 | * new main Location. |
||
454 | * |
||
455 | * @param mixed $locationId |
||
456 | * |
||
457 | * @return bool |
||
458 | */ |
||
459 | public function removeSubtree($locationId) |
||
463 | |||
464 | /** |
||
465 | * Set section on all content objects in the subtree. |
||
466 | * |
||
467 | * @param mixed $locationId |
||
468 | * @param mixed $sectionId |
||
469 | */ |
||
470 | public function setSectionForSubtree($locationId, $sectionId) |
||
474 | |||
475 | /** |
||
476 | * Changes main location of content identified by given $contentId to location identified by given $locationId. |
||
477 | * |
||
478 | * Updates ezcontentobject_tree and eznode_assignment tables (eznode_assignment for content current version number). |
||
479 | * |
||
480 | * @param mixed $contentId |
||
481 | * @param mixed $locationId |
||
482 | */ |
||
483 | public function changeMainLocation($contentId, $locationId) |
||
487 | } |
||
488 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.