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

Core/SignalSlot/URLAliasService.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\SignalSlot;
8
9 use eZ\Publish\API\Repository\URLAliasService as URLAliasServiceInterface;
10 use eZ\Publish\API\Repository\Values\Content\Location;
11 use eZ\Publish\Core\SignalSlot\Signal\LocationService\UpdateLocationSignal;
12 use eZ\Publish\Core\SignalSlot\Signal\URLAliasService\CreateUrlAliasSignal;
13 use eZ\Publish\Core\SignalSlot\Signal\URLAliasService\CreateGlobalUrlAliasSignal;
14 use eZ\Publish\Core\SignalSlot\Signal\URLAliasService\RemoveAliasesSignal;
15
19 class URLAliasService implements URLAliasServiceInterface
20 {
26 protected $service;
27
33 protected $signalDispatcher;
34
44 public function __construct(URLAliasServiceInterface $service, SignalDispatcher $signalDispatcher)
45 {
46 $this->service = $service;
47 $this->signalDispatcher = $signalDispatcher;
48 }
49
68 public function createUrlAlias(Location $location, $path, $languageCode, $forwarding = false, $alwaysAvailable = false)
69 {
70 $returnValue = $this->service->createUrlAlias($location, $path, $languageCode, $forwarding, $alwaysAvailable);
71 $this->signalDispatcher->emit(
72 new CreateUrlAliasSignal(
73 [
74 'urlAliasId' => $returnValue->id,
75 ]
76 )
77 );
78
79 return $returnValue;
80 }
81
103 public function createGlobalUrlAlias($resource, $path, $languageCode, $forwarding = false, $alwaysAvailable = false)
104 {
105 $returnValue = $this->service->createGlobalUrlAlias($resource, $path, $languageCode, $forwarding, $alwaysAvailable);
106 $this->signalDispatcher->emit(
107 new CreateGlobalUrlAliasSignal(
108 [
109 'urlAliasId' => $returnValue->id,
110 ]
111 )
112 );
113
114 return $returnValue;
115 }
116
128 public function listLocationAliases(
129 Location $location,
130 $custom = true,
131 $languageCode = null,
132 bool $showAllTranslations = null,
133 array $prioritizedLanguageList = null
134 ) {
135 return $this->service->listLocationAliases(
136 $location,
137 $custom,
138 $languageCode,
139 $showAllTranslations,
140 $prioritizedLanguageList
141 );
142 }
143
153 public function listGlobalAliases($languageCode = null, $offset = 0, $limit = -1)
154 {
155 return $this->service->listGlobalAliases($languageCode, $offset, $limit);
156 }
157
168 public function removeAliases(array $aliasList)
169 {
170 $returnValue = $this->service->removeAliases($aliasList);
171 $this->signalDispatcher->emit(
172 new RemoveAliasesSignal(
173 [
174 'aliasList' => $aliasList,
175 ]
176 )
177 );
178
179 return $returnValue;
180 }
181
192 public function lookup($url, $languageCode = null)
193 {
194 return $this->service->lookup($url, $languageCode);
195 }
196
211 public function reverseLookup(
212 Location $location,
213 $languageCode = null,
214 bool $showAllTranslations = null,
215 array $prioritizedLanguageList = null
216 ) {
217 return $this->service->reverseLookup(
218 $location,
219 $languageCode,
220 $showAllTranslations,
221 $prioritizedLanguageList
222 );
223 }
224
234 public function load($id)
235 {
236 return $this->service->load($id);
237 }
238
244 public function refreshSystemUrlAliasesForLocation(Location $location): void
245 {
246 $this->service->refreshSystemUrlAliasesForLocation($location);
247
248 $this->signalDispatcher->emit(
249 new UpdateLocationSignal(
250 [
251 'contentId' => $location->contentId,
252 'locationId' => $location->id,
253 'parentLocationId' => $location->parentLocationId,
254 ]
255 )
256 );
257 }
258
264 public function deleteCorruptedUrlAliases(): int
265 {
266 return $this->service->deleteCorruptedUrlAliases();
267 }
268 }
eZ\Publish\API\Repository\Values\Content\Location
Definition: API/Repository/Values/Content/Location.php:32
eZ\Publish\Core\SignalSlot\SignalDispatcher
Dispatches Signals to their assigned Slots.
Definition: SignalDispatcher.php:20
eZ\Publish\Core\SignalSlot\Signal\LocationService\UpdateLocationSignal
UpdateLocationSignal class.
Definition: UpdateLocationSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\URLAliasService\CreateGlobalUrlAliasSignal
CreateGlobalUrlAliasSignal class.
Definition: CreateGlobalUrlAliasSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\URLAliasService\CreateUrlAliasSignal
CreateUrlAliasSignal class.
Definition: CreateUrlAliasSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\URLAliasService\RemoveAliasesSignal
RemoveAliasesSignal class.
Definition: RemoveAliasesSignal.php:15
eZ\Publish\Core\SignalSlot\URLAliasService
URLAliasService class.
Definition: Core/SignalSlot/URLAliasService.php:20
eZ\Publish\Core\SignalSlot\URLAliasService\__construct
__construct(URLAliasServiceInterface $service, SignalDispatcher $signalDispatcher)
Constructor.
Definition: Core/SignalSlot/URLAliasService.php:44
eZ\Publish\Core\SignalSlot\URLAliasService\listLocationAliases
listLocationAliases(Location $location, $custom=true, $languageCode=null, bool $showAllTranslations=null, array $prioritizedLanguageList=null)
List of url aliases pointing to $location, sorted by language priority.
Definition: Core/SignalSlot/URLAliasService.php:128
eZ\Publish\Core\SignalSlot\URLAliasService\$signalDispatcher
$signalDispatcher
Definition: Core/SignalSlot/URLAliasService.php:33
eZ\Publish\Core\SignalSlot\URLAliasService\listGlobalAliases
listGlobalAliases($languageCode=null, $offset=0, $limit=-1)
List global aliases.
Definition: Core/SignalSlot/URLAliasService.php:153
eZ\Publish\Core\SignalSlot\URLAliasService\reverseLookup
reverseLookup(Location $location, $languageCode=null, bool $showAllTranslations=null, array $prioritizedLanguageList=null)
Returns the URL alias for the given location in the given language.
Definition: Core/SignalSlot/URLAliasService.php:211
eZ\Publish\Core\SignalSlot\URLAliasService\lookup
lookup($url, $languageCode=null)
looks up the URLAlias for the given url.
Definition: Core/SignalSlot/URLAliasService.php:192
eZ\Publish\Core\SignalSlot\URLAliasService\createUrlAlias
createUrlAlias(Location $location, $path, $languageCode, $forwarding=false, $alwaysAvailable=false)
Create a user chosen $alias pointing to $location in $languageCode.
Definition: Core/SignalSlot/URLAliasService.php:68
eZ\Publish\Core\SignalSlot\URLAliasService\removeAliases
removeAliases(array $aliasList)
Removes urls aliases.
Definition: Core/SignalSlot/URLAliasService.php:168
eZ\Publish\Core\SignalSlot\URLAliasService\load
load($id)
Loads URL alias by given $id.
Definition: Core/SignalSlot/URLAliasService.php:234
eZ\Publish\Core\SignalSlot\URLAliasService\$service
$service
Definition: Core/SignalSlot/URLAliasService.php:26
eZ\Publish\Core\SignalSlot\URLAliasService\refreshSystemUrlAliasesForLocation
refreshSystemUrlAliasesForLocation(Location $location)
Refresh all system URL aliases for the given Location (and historize outdated if needed).
Definition: Core/SignalSlot/URLAliasService.php:244
eZ\Publish\Core\SignalSlot\URLAliasService\deleteCorruptedUrlAliases
deleteCorruptedUrlAliases()
Delete global, system or custom URL alias pointing to non-existent Locations.
Definition: Core/SignalSlot/URLAliasService.php:264
eZ\Publish\Core\SignalSlot\URLAliasService\createGlobalUrlAlias
createGlobalUrlAlias($resource, $path, $languageCode, $forwarding=false, $alwaysAvailable=false)
Create a user chosen $alias pointing to a resource in $languageCode.
Definition: Core/SignalSlot/URLAliasService.php:103
eZ\Publish\API\Repository\URLAliasService
Definition: API/Repository/URLAliasService.php:17
eZ\Publish\Core\SignalSlot
Definition: Core/SignalSlot/BookmarkService.php:9
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.