1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* LocationService class. |
5
|
|
|
* |
6
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
7
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
namespace eZ\Publish\Core\Repository\SiteAccessAware; |
10
|
|
|
|
11
|
|
|
use eZ\Publish\API\Repository\LocationService as LocationServiceInterface; |
12
|
|
|
use eZ\Publish\API\Repository\Values\Content\Location; |
13
|
|
|
use eZ\Publish\API\Repository\Values\Content\ContentInfo; |
14
|
|
|
use eZ\Publish\API\Repository\Values\Content\VersionInfo; |
15
|
|
|
use eZ\Publish\API\Repository\Values\Content\LocationCreateStruct; |
16
|
|
|
use eZ\Publish\API\Repository\Values\Content\LocationUpdateStruct; |
17
|
|
|
use eZ\Publish\Core\Repository\SiteAccessAware\Language\LanguageResolver; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* LocationService for SiteAccessAware layer. |
21
|
|
|
* |
22
|
|
|
* Currently does nothing but hand over calls to aggregated service. |
23
|
|
|
*/ |
24
|
|
|
class LocationService implements LocationServiceInterface |
25
|
|
|
{ |
26
|
|
|
/** @var \eZ\Publish\API\Repository\LocationService */ |
27
|
|
|
protected $service; |
28
|
|
|
|
29
|
|
|
/** @var \eZ\Publish\Core\Repository\SiteAccessAware\Language\LanguageResolver */ |
30
|
|
|
protected $languageResolver; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Construct service object from aggregated service and LanguageResolver. |
34
|
|
|
* |
35
|
|
|
* @param \eZ\Publish\API\Repository\LocationService $service |
36
|
|
|
* @param \eZ\Publish\Core\Repository\SiteAccessAware\Language\LanguageResolver $languageResolver |
37
|
|
|
*/ |
38
|
|
|
public function __construct( |
39
|
|
|
LocationServiceInterface $service, |
40
|
|
|
LanguageResolver $languageResolver |
41
|
|
|
) { |
42
|
|
|
$this->service = $service; |
43
|
|
|
$this->languageResolver = $languageResolver; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function copySubtree(Location $subtree, Location $targetParentLocation) |
47
|
|
|
{ |
48
|
|
|
return $this->service->copySubtree($subtree, $targetParentLocation); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function loadLocation($locationId, array $prioritizedLanguages = null) |
52
|
|
|
{ |
53
|
|
|
return $this->service->loadLocation( |
54
|
|
|
$locationId, |
55
|
|
|
$this->languageResolver->getPrioritizedLanguages($prioritizedLanguages) |
56
|
|
|
); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function loadLocationByRemoteId($remoteId, array $prioritizedLanguages = null) |
60
|
|
|
{ |
61
|
|
|
return $this->service->loadLocationByRemoteId( |
62
|
|
|
$remoteId, |
63
|
|
|
$this->languageResolver->getPrioritizedLanguages($prioritizedLanguages) |
64
|
|
|
); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function loadLocations(ContentInfo $contentInfo, Location $rootLocation = null, array $prioritizedLanguages = null) |
68
|
|
|
{ |
69
|
|
|
return $this->service->loadLocations( |
70
|
|
|
$contentInfo, |
71
|
|
|
$rootLocation, |
72
|
|
|
$this->languageResolver->getPrioritizedLanguages($prioritizedLanguages) |
73
|
|
|
); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function loadLocationChildren(Location $location, $offset = 0, $limit = 25, array $prioritizedLanguages = null) |
77
|
|
|
{ |
78
|
|
|
return $this->service->loadLocationChildren( |
79
|
|
|
$location, |
80
|
|
|
$offset, |
81
|
|
|
$limit, |
82
|
|
|
$this->languageResolver->getPrioritizedLanguages($prioritizedLanguages) |
83
|
|
|
); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function loadParentLocationsForDraftContent(VersionInfo $versionInfo, array $prioritizedLanguages = null) |
87
|
|
|
{ |
88
|
|
|
return $this->service->loadParentLocationsForDraftContent( |
89
|
|
|
$versionInfo, |
90
|
|
|
$this->languageResolver->getPrioritizedLanguages($prioritizedLanguages) |
91
|
|
|
); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function getLocationChildCount(Location $location) |
95
|
|
|
{ |
96
|
|
|
return $this->service->getLocationChildCount($location); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function createLocation(ContentInfo $contentInfo, LocationCreateStruct $locationCreateStruct) |
100
|
|
|
{ |
101
|
|
|
return $this->service->createLocation($contentInfo, $locationCreateStruct); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function updateLocation(Location $location, LocationUpdateStruct $locationUpdateStruct) |
105
|
|
|
{ |
106
|
|
|
return $this->service->updateLocation($location, $locationUpdateStruct); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function swapLocation(Location $location1, Location $location2) |
110
|
|
|
{ |
111
|
|
|
return $this->service->swapLocation($location1, $location2); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function hideLocation(Location $location) |
115
|
|
|
{ |
116
|
|
|
return $this->service->hideLocation($location); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function unhideLocation(Location $location) |
120
|
|
|
{ |
121
|
|
|
return $this->service->unhideLocation($location); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function moveSubtree(Location $location, Location $newParentLocation) |
125
|
|
|
{ |
126
|
|
|
return $this->service->moveSubtree($location, $newParentLocation); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
public function deleteLocation(Location $location) |
130
|
|
|
{ |
131
|
|
|
$this->service->deleteLocation($location); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
public function newLocationCreateStruct($parentLocationId) |
135
|
|
|
{ |
136
|
|
|
return $this->service->newLocationCreateStruct($parentLocationId); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function newLocationUpdateStruct() |
140
|
|
|
{ |
141
|
|
|
return $this->service->newLocationUpdateStruct(); |
142
|
|
|
} |
143
|
|
|
} |
144
|
|
|
|