Class

eZ\Publish\Core\Persistence\Cache\UrlAliasHandler

class UrlAliasHandler extends AbstractHandler implements Handler

Constants

NOT_FOUND

Constant used for storing not found results for lookup().

Methods

publishUrlAliasForLocation(mixed $locationId, mixed $parentLocationId, string $name, string $languageCode, bool $alwaysAvailable = false, $updatePathIdentificationString = false)

This method creates or updates an urlalias from a new or changed content name in a language (if published).

UrlAlias createCustomUrlAlias(mixed $locationId, string $path, bool $forwarding = false, string|null $languageCode = null, bool $alwaysAvailable = false)

Create a user chosen $alias pointing to $locationId in $languageCode.

UrlAlias createGlobalUrlAlias(string $resource, string $path, bool $forwarding = false, string|null $languageCode = null, bool $alwaysAvailable = false)

Create a user chosen $alias pointing to a resource in $languageCode.

UrlAlias[] listGlobalURLAliases(string|null $languageCode = null, int $offset, int $limit = -1)

List global aliases.

UrlAlias[] listURLAliasesForLocation(mixed $locationId, bool $custom = false)

List of url entries of $urlType, pointing to $locationId.

bool removeURLAliases(array $urlAliases)

Removes url aliases.

UrlAlias lookup(string $url)

Looks up a url alias for the given url.

UrlAlias loadUrlAlias(string $id)

Loads URL alias by given $id.

locationMoved(mixed $locationId, mixed $oldParentId, mixed $newParentId)

Notifies the underlying engine that a location has moved.

locationCopied(mixed $locationId, mixed $newLocationId, mixed $newParentId)

Notifies the underlying engine that a location was copied.

locationDeleted(mixed $locationId)

Notifies the underlying engine that a location was deleted or moved to trash.

locationSwapped(string|int $location1Id, string|int $location1ParentId, string|int $location2Id, string|int $location2ParentId)

Notifies the underlying engine that a location was swapped.

translationRemoved(array $locationIds, string $languageCode)

Notifies the underlying engine that Locations Content Translation was removed.

archiveUrlAliasesForDeletedTranslations(int $locationId, int $parentLocationId, array $languageCodes)

Archive UrlAliases for Translations that were removed from the underlying published content.

Details

at line 29
public publishUrlAliasForLocation(mixed $locationId, mixed $parentLocationId, string $name, string $languageCode, bool $alwaysAvailable = false, $updatePathIdentificationString = false)

This method creates or updates an urlalias from a new or changed content name in a language (if published).

It also can be used to create an alias for a new location of content. On update the old alias is linked to the new one (i.e. a history alias is generated).

$alwaysAvailable controls whether the url alias is accessible in all languages.

Parameters

mixed $locationId
mixed $parentLocationId
string $name the new name computed by the name schema or url alias schema
string $languageCode
bool $alwaysAvailable
$updatePathIdentificationString

at line 63
public UrlAlias createCustomUrlAlias(mixed $locationId, string $path, bool $forwarding = false, string|null $languageCode = null, bool $alwaysAvailable = false)

Create a user chosen $alias pointing to $locationId in $languageCode.

If $languageCode is null the $alias is created in the system's default language. $alwaysAvailable makes the alias available in all languages.

Parameters

mixed $locationId
string $path
bool $forwarding
string|null $languageCode
bool $alwaysAvailable

Return Value

UrlAlias

at line 92
public UrlAlias createGlobalUrlAlias(string $resource, string $path, bool $forwarding = false, string|null $languageCode = null, bool $alwaysAvailable = false)

Create a user chosen $alias pointing to a resource in $languageCode.

This method does not handle location resources - if a user enters a location target the createCustomUrlAlias method has to be used.

If $languageCode is null the $alias is created in the system's default language. $alwaysAvailable makes the alias available in all languages.

Parameters

string $resource
string $path
bool $forwarding
string|null $languageCode
bool $alwaysAvailable

Return Value

UrlAlias

at line 121
public UrlAlias[] listGlobalURLAliases(string|null $languageCode = null, int $offset, int $limit = -1)

List global aliases.

Parameters

string|null $languageCode
int $offset
int $limit

Return Value

UrlAlias[]

at line 131
public UrlAlias[] listURLAliasesForLocation(mixed $locationId, bool $custom = false)

List of url entries of $urlType, pointing to $locationId.

Parameters

mixed $locationId
bool $custom if true the user generated aliases are listed otherwise the autogenerated

Return Value

UrlAlias[]

at line 155
public bool removeURLAliases(array $urlAliases)

Removes url aliases.

Autogenerated aliases are not removed by this method.

Parameters

array $urlAliases

Return Value

bool

at line 179
public UrlAlias lookup(string $url)

Looks up a url alias for the given url.

Parameters

string $url

Return Value

UrlAlias

Exceptions

NotFoundException

at line 213
public UrlAlias loadUrlAlias(string $id)

Loads URL alias by given $id.

Parameters

string $id

Return Value

UrlAlias

Exceptions

NotFoundException

at line 233
public locationMoved(mixed $locationId, mixed $oldParentId, mixed $newParentId)

Notifies the underlying engine that a location has moved.

This method triggers the change of the autogenerated aliases

Parameters

mixed $locationId
mixed $oldParentId
mixed $newParentId

at line 254
public locationCopied(mixed $locationId, mixed $newLocationId, mixed $newParentId)

Notifies the underlying engine that a location was copied.

This method triggers the creation of the autogenerated aliases for the copied locations

Parameters

mixed $locationId
mixed $newLocationId
mixed $newParentId

at line 278
public locationDeleted(mixed $locationId)

Notifies the underlying engine that a location was deleted or moved to trash.

Parameters

mixed $locationId

at line 291
public locationSwapped(string|int $location1Id, string|int $location1ParentId, string|int $location2Id, string|int $location2ParentId)

Notifies the underlying engine that a location was swapped.

This method triggers the change of the autogenerated aliases.

Parameters

string|int $location1Id
string|int $location1ParentId
string|int $location2Id
string|int $location2ParentId

at line 325
public translationRemoved(array $locationIds, string $languageCode)

Notifies the underlying engine that Locations Content Translation was removed.

Parameters

array $locationIds all Locations of the Content that got Translation removed
string $languageCode language code of the removed Translation

at line 346
public archiveUrlAliasesForDeletedTranslations(int $locationId, int $parentLocationId, array $languageCodes)

Archive UrlAliases for Translations that were removed from the underlying published content.

Parameters

int $locationId Location of underlying published Content Object
int $parentLocationId
array $languageCodes Language codes of currently published Content Object Translations