eZPublishCommunityProject  2013.4
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:
+ Collaboration diagram for eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler:

Public Member Functions

 __construct (Gateway $gateway, Mapper $mapper, LocationGateway $locationGateway, LanguageHandler $languageHandler, SlugConverter $slugConverter)
 Creates a new UrlAlias Handler. More...
 
 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...
 
 listGlobalURLAliases ($languageCode=null, $offset=0, $limit=-1)
 List global aliases. More...
 
 listURLAliasesForLocation ($locationId, $custom=false)
 List of user generated or autogenerated url entries, pointing to $locationId. More...
 
 loadUrlAlias ($id)
 Loads URL alias by given $id. More...
 
 locationCopied ($locationId, $newLocationId, $newParentId)
 Notifies the underlying engine that a location has moved. More...
 
 locationDeleted ($locationId)
 Notifies the underlying engine that a location was deleted or moved to trash. More...
 
 locationMoved ($locationId, $oldParentId, $newParentId)
 Notifies the underlying engine that a location has moved. More...
 
 lookup ($url)
 Looks up a url alias for the given url. More...
 
 removeURLAliases (array $urlAliases)
 Removes url aliases. 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...
 

Protected Member Functions

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

Protected Attributes

 $gateway
 
 $languageHandler
 
 $locationGateway
 
 $mapper
 
 $slugConverter
 

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.

Constructor & Destructor Documentation

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::__construct ( Gateway  $gateway,
Mapper  $mapper,
LocationGateway  $locationGateway,
LanguageHandler  $languageHandler,
SlugConverter  $slugConverter 
)

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

Member Function Documentation

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::copySubtree (   $actionMap,
  $oldParentAliasId,
  $newParentAliasId 
)
protected

Recursively copies aliases from old parent under new parent.

Parameters
array$actionMap
mixed$oldParentAliasId
mixed$newParentAliasId
Returns
void

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

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.

Parameters
mixed$locationId
string$path
boolean$forwarding
string$languageCode
boolean$alwaysAvailable
Returns

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

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
\eZ\Publish\API\Repository\Exceptions\ForbiddenExceptionif the path already exists for the given language
Parameters
string$resource
string$path
boolean$forwarding
string$languageCode
boolean$alwaysAvailable
Returns

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

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
\eZ\Publish\Core\Base\Exceptions\ForbiddenExceptionif the path already exists for the given language
Parameters
string$action
string$path
boolean$forward
string | null$languageCode
boolean$alwaysAvailable
Returns

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

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::getCopiedLocationsMap (   $oldParentId,
  $newParentId 
)
protected
Parameters
mixed$oldParentId
mixed$newParentId
Returns
array

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

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

Returns possibly corrected alias id for given $locationId.

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

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

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

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

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

List global aliases.

Parameters
string | null$languageCode
int$offset
int$limit
Returns
[]

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

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

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

Parameters
mixed$locationId
boolean$customif true the user generated aliases are listed otherwise the autogenerated
Returns
[]

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

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

Loads URL alias by given $id.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundException
Parameters
string$id
Returns

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

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::locationCopied (   $locationId,
  $newLocationId,
  $newParentId 
)

Notifies the underlying engine that a location has moved.

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

Parameters
mixed$locationId
mixed$oldParentId
mixed$newParentId
Returns
void

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

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

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

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
Returns
void

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

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

Looks up a url alias for the given url.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundException
\RuntimeException
\eZ\Publish\Core\Base\Exceptions\NotFoundException
Parameters
string$url
Returns

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

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

Recursively removes aliases by given parent id and action.

Parameters
mixed$parentId
string$action
Returns
void

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

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
boolean

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

Member Data Documentation

eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::$gateway
protected
eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::$languageHandler
protected
eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::$locationGateway
protected
eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::$mapper
protected
eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::$slugConverter
protected

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