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

Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler Class Reference

The UrlAlias Handler provides nice urls management. More...

Inheritance diagram for eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler:

## Public Member Functions
| __construct (Gateway $gateway, Mapper $mapper, LocationGateway $locationGateway, LanguageHandler $languageHandler, SlugConverter $slugConverter, ContentGateway $contentGateway, MaskGenerator $maskGenerator, TransactionHandler $transactionHandler)
| Creates a new UrlAlias Handler. More...
| publishUrlAliasForLocation ( $locationId, $parentLocationId, $name, $languageCode, $alwaysAvailable=false, $updatePathIdentificationString=false)
| createCustomUrlAlias ($locationId, $path, $forwarding=false, $languageCode=null, $alwaysAvailable=false)
| Create a user chosen $alias pointing to $locationId in $languageCode. More...
| createGlobalUrlAlias ($resource, $path, $forwarding=false, $languageCode=null, $alwaysAvailable=false)
| Create a user chosen $alias pointing to a resource in $languageCode. More...
| listURLAliasesForLocation ($locationId, $custom=false)
| List of user generated or autogenerated url entries, pointing to $locationId. More...
| listGlobalURLAliases ($languageCode=null, $offset=0, $limit=-1)
| List global aliases. More...
| removeURLAliases (array $urlAliases)
| Removes url aliases. More...
| lookup ($url)
| Looks up a url alias for the given url. More...
| loadUrlAlias ($id)
| Loads URL alias by given $id. More...
| locationMoved ($locationId, $oldParentId, $newParentId)
| Notifies the underlying engine that a location has moved. More...
| locationCopied ($locationId, $newLocationId, $newParentId)
| Notifies the underlying engine that a location was copied. More...
| locationSwapped ($location1Id, $location1ParentId, $location2Id, $location2ParentId)
| Notify the underlying engine that a Location has been swapped. More...
| locationDeleted ($locationId)
| Notifies the underlying engine that a location was deleted or moved to trash. More...
| translationRemoved (array $locationIds, $languageCode)
| Notifies the underlying engine that Locations Content Translation was removed. More...
| archiveUrlAliasesForDeletedTranslations ($locationId, $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
} More...
| deleteCorruptedUrlAliases ()
| Remove corrupted URL aliases (global, custom and system). More...
| repairBrokenUrlAliasesForLocation (int $locationId)
| Attempt repairing auto-generated URL aliases for the given Location (including history). More...
Public Member Functions inherited from eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler
| publishUrlAliasForLocation ($locationId, $parentLocationId, $name, $languageCode, $alwaysAvailable=false)
| This method creates or updates an urlalias from a new or changed content name in a language (if published). More...

## Public Attributes
const | ROOT_LOCATION_ID = 1
const | CONTENT_REPOSITORY_ROOT_LOCATION_ID = 2
| This is intentionally hardcoded for now as: More...
const | MAX_URL_ALIAS_DEPTH_LEVEL = 60
| The maximum level of alias depth. More...

## Protected Member Functions
| createUrlAlias ($action, $path, $forward, $languageCode, $alwaysAvailable)
| Internal method for creating global or custom URL alias (these are handled in the same way). More...
| insertNopEntry ($parentId, $text, $textMD5)
| Convenience method for inserting nop type row. More...
| getRealAliasId ($locationId)
| Returns possibly corrected alias id for given $locationId !! For use as parent id in logic. More...
| copySubtree ($actionMap, $oldParentAliasId, $newParentAliasId, array $alreadyGeneratedAliases=[])
| Recursively copies aliases from old parent under new parent. More...
| getCopiedLocationsMap ($oldParentId, $newParentId)
| removeSubtree ($id, $action, $original)
| Recursively removes aliases by given $id and $action. More...
| getHash ($text)

## Protected Attributes
| $gateway
| $locationGateway
| $mapper
| $languageHandler
| $slugConverter
| $contentGateway
| $maskGenerator

## Private Member Functions
| internalPublishUrlAliasForLocation ( $locationId, $parentLocationId, $name, $languageId, $alwaysAvailable=false, $updatePathIdentificationString=false, $newId=null)
| Internal publish method, accepting language ID instead of language code and optionally new alias ID (used when swapping Locations). More...
| getNamesForAllLanguages (array $contentInfo)
| historizeBeforeSwap ($location1Entries, $location2Entries)
| Historizes given existing active entries for two swapped Locations. More...
| shouldUrlAliasForSecondLocationBePublishedFirst (array $location1Entries, $location1ParentId, $name1, array $location2Entries, $location2ParentId, $name2, $languageId)
| Decides if UrlAlias for $location2 should be published first. More...
| getUrlAliasesForSwappedLocations (Language $language, SwappedLocationProperties $location1, SwappedLocationProperties $location2)
| Get in a proper order - to be published - a list of URL aliases for swapped Locations. More...
| getLocationEntryInLanguage (array $locationEntries, $languageId)
| insertAliasEntryAsNop (array $aliasEntry)
| internalPublishCustomUrlAliasForLocation (SwappedLocationProperties $location, int $languageMask)
| Internal publish custom aliases method, accepting language mask to set correct language mask on url aliases new alias ID (used when swapping Locations). More...

## Private Attributes
| $transactionHandler

## Detailed Description

The UrlAlias Handler provides nice urls management.

Its methods operate on a representation of the url alias data structure held inside a storage engine.

Definition at line 31 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::__construct | ( | Gateway | $gateway,
|  | Mapper | $mapper,
|  | LocationGateway | $locationGateway,
|  | LanguageHandler | $languageHandler,
|  | SlugConverter | $slugConverter,
|  | ContentGateway | $contentGateway,
|  | MaskGenerator | $maskGenerator,
|  | TransactionHandler | $transactionHandler
| ) |  |

Creates a new UrlAlias Handler.

Parameters

  \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway | $gateway |
  \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Mapper | $mapper |
  \eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway | $locationGateway |
  \eZ\Publish\SPI\Persistence\Content\Language\Handler | $languageHandler |
  \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter | $slugConverter |
  \eZ\Publish\Core\Persistence\Legacy\Content\Gateway | $contentGateway |
  \eZ\Publish\Core\Persistence\Legacy\Content\Language\MaskGenerator | $maskGenerator |
  \eZ\Publish\SPI\Persistence\TransactionHandler | $transactionHandler |

Definition at line 113 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\$contentGateway, eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\$gateway, eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\$languageHandler, eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\$locationGateway, eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\$mapper, eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\$maskGenerator, eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\$slugConverter, and eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\$transactionHandler.

## Member Function Documentation

## ◆ archiveUrlAliasesForDeletedTranslations()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::archiveUrlAliasesForDeletedTranslations | ( |  | $locationId,
|  |  | $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

}

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 1095 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\getRealAliasId().

## ◆ copySubtree()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::copySubtree | ( |  | $actionMap,
|  |  | $oldParentAliasId,
|  |  | $newParentAliasId,
|  | array | $alreadyGeneratedAliases = `[]`
| ) |  |
| protected

Recursively copies aliases from old parent under new parent.

Parameters

  array | $actionMap |
  mixed | $oldParentAliasId |
  mixed | $newParentAliasId |
  string[] | $alreadyGeneratedAliases |

Definition at line 962 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\locationCopied().

## ◆ createCustomUrlAlias()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createCustomUrlAlias | ( |  | $locationId,
|  |  | $path,
|  |  | $forwarding = `false`,
|  |  | $languageCode = `null`,
|  |  | $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.

Exceptions

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 323 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\createUrlAlias().

## ◆ createGlobalUrlAlias()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createGlobalUrlAlias | ( |  | $resource,
|  |  | $path,
|  |  | $forwarding = `false`,
|  |  | $languageCode = `null`,
|  |  | $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.

Exceptions

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 354 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\createUrlAlias().

## ◆ createUrlAlias()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::createUrlAlias | ( |  | $action,
|  |  | $path,
|  |  | $forward,
|  |  | $languageCode,
|  |  | $alwaysAvailable
| ) |  |
| protected

Internal method for creating global or custom URL alias (these are handled in the same way).

Exceptions

Definition at line 380 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\getHash(), eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\insertNopEntry(), and eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway\NOP_ACTION.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\createCustomUrlAlias(), and eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\createGlobalUrlAlias().

## ◆ deleteCorruptedUrlAliases()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::deleteCorruptedUrlAliases | ( |  | ) |

Remove corrupted URL aliases (global, custom and system).

Returns
  int Number of removed URL aliases

Exceptions

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 1128 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

## ◆ getCopiedLocationsMap()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::getCopiedLocationsMap | ( |  | $oldParentId,
|  |  | $newParentId
| ) |  |
| protected

Parameters

  mixed | $oldParentId |
  mixed | $newParentId |

Returns
  array

Definition at line 1003 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\locationCopied().

## ◆ getHash()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::getHash | ( |  | $text | ) |
| protected

Parameters

  string | $text |

Returns
  string

Definition at line 1087 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\createUrlAlias(), eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\internalPublishUrlAliasForLocation(), and eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\lookup().

## ◆ getLocationEntryInLanguage()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::getLocationEntryInLanguage | ( | array | $locationEntries,
|  |  | $languageId
| ) |  |
| private

Parameters

  array | $locationEntries |
  int | $languageId |

Returns
  array|null

Definition at line 910 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\shouldUrlAliasForSecondLocationBePublishedFirst().

## ◆ getNamesForAllLanguages()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::getNamesForAllLanguages | ( | array | $contentInfo | ) |
| private

Parameters

  array | $contentInfo |

Returns
  array

Definition at line 761 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\locationSwapped().

## ◆ getRealAliasId()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::getRealAliasId | ( |  | $locationId | ) |
| protected

Returns possibly corrected alias id for given $locationId !! For use as parent id in logic.

First level entries must have parent id set to 0 instead of their parent location alias id. There are two cases when alias id needs to be corrected: 1) location is special location without URL alias (location with id=1 in standard installation) 2) location is site root location, having special root entry in the ezurlalias_ml table (location with id=2 in standard installation)

Parameters

  mixed | $locationId |

Returns
  mixed

Definition at line 935 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\archiveUrlAliasesForDeletedTranslations(), eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\internalPublishUrlAliasForLocation(), eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\locationCopied(), and eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\locationMoved().

## ◆ getUrlAliasesForSwappedLocations()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::getUrlAliasesForSwappedLocations | ( | Language | $language,
|  | SwappedLocationProperties | $location1,
|  | SwappedLocationProperties | $location2
| ) |  |
| private

Get in a proper order - to be published - a list of URL aliases for swapped Locations.

See also
  shouldUrlAliasForSecondLocationBePublishedFirst

Parameters

  \eZ\Publish\SPI\Persistence\Content\Language | $language |
  \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\DTO\SwappedLocationProperties | $location1 |
  \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\DTO\SwappedLocationProperties | $location2 |

Returns
  \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\DTO\UrlAliasForSwappedLocation[]

Definition at line 859 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\locationSwapped().

## ◆ historizeBeforeSwap()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::historizeBeforeSwap | ( |  | $location1Entries,
|  |  | $location2Entries
| ) |  |
| private

Historizes given existing active entries for two swapped Locations.

This should be done before republishing URL aliases, in order to avoid unnecessary conflicts when swapped Locations are siblings.

We need to historize everything separately per language (mask), in case the entries remain history future publishing reusages need to be able to take them over cleanly.

See also
  \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationSwapped()

Parameters

  array | $location1Entries |
  array | $location2Entries |

Definition at line 793 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\locationSwapped().

## ◆ insertAliasEntryAsNop()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::insertAliasEntryAsNop | ( | array | $aliasEntry | ) |
| private

Definition at line 1164 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway\NOP, and eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway\NOP_ACTION.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\locationDeleted().

## ◆ insertNopEntry()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::insertNopEntry | ( |  | $parentId,
|  |  | $text,
|  |  | $textMD5
| ) |  |
| protected

Convenience method for inserting nop type row.

Parameters

  mixed | $parentId |
  string | $text |
  string | $textMD5 |

Returns
  mixed

Definition at line 484 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway\NOP_ACTION.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\createUrlAlias().

## ◆ internalPublishCustomUrlAliasForLocation()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::internalPublishCustomUrlAliasForLocation | ( | SwappedLocationProperties | $location,
|  | int | $languageMask
| ) |  |
| private

Internal publish custom aliases method, accepting language mask to set correct language mask on url aliases new alias ID (used when swapping Locations).

Definition at line 1176 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\locationSwapped().

## ◆ internalPublishUrlAliasForLocation()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::internalPublishUrlAliasForLocation | ( |  | $locationId,
|  |  | $parentLocationId,
|  |  | $name,
|  |  | $languageId,
|  |  | $alwaysAvailable = `false`,
|  |  | $updatePathIdentificationString = `false`,
|  |  | $newId = `null`
| ) |  |
| private

Internal publish method, accepting language ID instead of language code and optionally new alias ID (used when swapping Locations).

See also
  \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationSwapped()

Parameters

  int | $locationId |
  int | $parentLocationId |
  string | $name |
  int | $languageId |
  bool | $alwaysAvailable |
  bool | $updatePathIdentificationString | legacy storage specific for updating ezcontentobject_tree.path_identification_string
  int | $newId |

Definition at line 167 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\getHash(), eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\getRealAliasId(), and eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway\NOP_ACTION.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\locationSwapped(), and eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\publishUrlAliasForLocation().

## ◆ listGlobalURLAliases()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::listGlobalURLAliases | ( |  | $languageCode = `null`,
|  |  | $offset = `0`,
|  |  | $limit = `-1`
| ) |  |

List global aliases.

Exceptions

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 528 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

## ◆ listURLAliasesForLocation()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::listURLAliasesForLocation | ( |  | $locationId,
|  |  | $custom = `false`
| ) |  |

List of user generated or autogenerated url entries, pointing to $locationId.

Exceptions

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 507 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

## ◆ loadUrlAlias()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::loadUrlAlias | ( |  | $id | ) |

Loads URL alias by given $id.

Exceptions

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 619 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

## ◆ locationCopied()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationCopied | ( |  | $locationId,
|  |  | $newLocationId,
|  |  | $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 |

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 676 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\copySubtree(), eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\getCopiedLocationsMap(), and eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\getRealAliasId().

## ◆ locationDeleted()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationDeleted | ( |  | $locationId | ) |

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

Parameters

  mixed | $locationId |

Returns
  array

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 1016 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\insertAliasEntryAsNop(), and eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\removeSubtree().

## ◆ locationMoved()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationMoved | ( |  | $locationId,
|  |  | $oldParentId,
|  |  | $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 |

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 642 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\getRealAliasId().

## ◆ locationSwapped()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationSwapped | ( |  | $location1Id,
|  |  | $location1ParentId,
|  |  | $location2Id,
|  |  | $location2ParentId
| ) |  |

Notify the underlying engine that a Location has been swapped.

This method triggers the change of the autogenerated aliases.

Parameters

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

Exceptions

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 702 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\getNamesForAllLanguages(), eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\getUrlAliasesForSwappedLocations(), eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\historizeBeforeSwap(), eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\internalPublishCustomUrlAliasForLocation(), and eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\internalPublishUrlAliasForLocation().

## ◆ lookup()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::lookup | ( |  | $url | ) |

Looks up a url alias for the given url.

Exceptions

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 572 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\getHash().

## ◆ publishUrlAliasForLocation()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation | ( |  | $locationId,
|  |  | $parentLocationId,
|  |  | $name,
|  |  | $languageCode,
|  |  | $alwaysAvailable = `false`,
|  |  | $updatePathIdentificationString = `false`
| ) |  |

Definition at line 133 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\internalPublishUrlAliasForLocation().

## ◆ removeSubtree()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::removeSubtree | ( |  | $id,
|  |  | $action,
|  |  | $original
| ) |  |
| protected

Recursively removes aliases by given $id and $action.

$original parameter is used to limit removal of moved Location aliases to history entries only.

Parameters

  mixed | $id |
  string | $action |
  mixed | $original |

Definition at line 1061 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\locationDeleted().

## ◆ removeURLAliases()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::removeURLAliases | ( | array | $urlAliases | ) |

Removes url aliases.

Autogenerated aliases are not removed by this method.

Parameters

  \eZ\Publish\SPI\Persistence\Content\UrlAlias[] | $urlAliases |

Returns
  bool

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 547 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

## ◆ repairBrokenUrlAliasesForLocation()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::repairBrokenUrlAliasesForLocation | ( | int | $locationId | ) |

Attempt repairing auto-generated URL aliases for the given Location (including history).

Note: it is assumed that at this point original, working, URL Alias for Location is published.

Parameters

  int | $locationId |

Exceptions

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 1155 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

## ◆ shouldUrlAliasForSecondLocationBePublishedFirst()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::shouldUrlAliasForSecondLocationBePublishedFirst | ( | array | $location1Entries,
|  |  | $location1ParentId,
|  |  | $name1,
|  | array | $location2Entries,
|  |  | $location2ParentId,
|  |  | $name2,
|  |  | $languageId
| ) |  |
| private

Decides if UrlAlias for $location2 should be published first.

The order in which Locations are published only matters if swapped Locations are siblings and they have the same name in a given language. In this case, the UrlAlias for Location which previously had lower number at the end of its UrlAlias text (or no number at all) should be published first. This ensures that the number still stays lower for this Location after the swap. If it wouldn't stay lower, then swapping Locations in conjunction with swapping UrlAliases would effectively cancel each other.

Parameters

  array | $location1Entries |
  int | $location1ParentId |
  string | $name1 |
  array | $location2Entries |
  int | $location2ParentId |
  string | $name2 |
  int | $languageId |

Returns
  bool

Definition at line 823 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\getLocationEntryInLanguage().

## ◆ translationRemoved()

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::translationRemoved | ( | array | $locationIds,
|  |  | $languageCode
| ) |  |

Notifies the underlying engine that Locations Content Translation was removed.

Parameters

  int[] | $locationIds | all Locations of the Content that got Translation removed
  string | $languageCode | language code of the removed Translation

Implements eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler.

Definition at line 1041 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

## Member Data Documentation

## ◆ $contentGateway

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::$contentGateway
| protected

Definition at line 89 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\__construct().

## ◆ $gateway

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::$gateway
| protected

Definition at line 54 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\__construct().

## ◆ $languageHandler

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::$languageHandler
| protected

Definition at line 75 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\__construct().

## ◆ $locationGateway

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::$locationGateway
| protected

Definition at line 61 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\__construct().

## ◆ $mapper

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::$mapper
| protected

Definition at line 68 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\__construct().

## ◆ $maskGenerator

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::$maskGenerator
| protected

Definition at line 96 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\__construct().

## ◆ $slugConverter

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::$slugConverter
| protected

Definition at line 82 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\__construct().

## ◆ $transactionHandler

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::$transactionHandler
| private

Definition at line 99 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler\__construct().

## ◆ CONTENT_REPOSITORY_ROOT_LOCATION_ID

const eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::CONTENT_REPOSITORY_ROOT_LOCATION_ID = 2

This is intentionally hardcoded for now as:

1. We don't implement this configuration option.

2. Such option should not be in this layer, should be handled higher up.

   Deprecated:

Definition at line 42 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

## ◆ MAX_URL_ALIAS_DEPTH_LEVEL

const eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::MAX_URL_ALIAS_DEPTH_LEVEL = 60

The maximum level of alias depth.

Definition at line 47 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

## ◆ ROOT_LOCATION_ID

const eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::ROOT_LOCATION_ID = 1

Definition at line 33 of file Core/Persistence/Legacy/Content/UrlAlias/Handler.php.

The documentation for this class was generated from the following file:

- Core/Persistence/Legacy/Content/UrlAlias/Handler.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.