eZPublishCommunityProject  2013.4
eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler Class Reference
+ Inheritance diagram for eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler:
+ Collaboration diagram for eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler:

Public Member Functions

 __construct (Handler $handler, Backend $backend)
 Setups current handler instance with reference to Handler object that created it. 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...
 
 createNewAlias ($linkId, $data, $languageCode, $name, $alwaysAvailable)
 Creates new alias. More...
 
 listGlobalURLAliases ($languageCode=null, $offset=0, $limit=-1)
 List global aliases. More...
 
 listURLAliasesForLocation ($locationId, $custom=false)
 List of url entries of $urlType, pointing to $locationId. More...
 
 loadUrlAlias ($id)
 Loads URL alias by given $id. More...
 
 locationDeleted ($locationId)
 Notifies the underlying engine that a location was deleted or moved to trash. More...
 
 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...
 
 removeURLAliases (array $urlAliases)
 Removes url aliases. More...
 
- Public Member Functions inherited from eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler
 locationCopied ($locationId, $oldParentId, $newParentId)
 Notifies the underlying engine that a location has moved. 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...
 

Protected Member Functions

 createUrlAlias ($resource, $path, $forwarding=false, $languageCode=null, $alwaysAvailable=false)
 Internal method for creating global or custom URL alias (these are handled in the same way) More...
 
 downgrade ($urlAlias, $languageCode)
 Remove translation in given $languageCode from alias or delete alias if given translation is the last one. More...
 
 expandAlias ($alias)
 Expands given $alias to array of new aliases for each different translation. More...
 
 getHash ($text)
 
 getNextLinkId ()
 Returns max found link id incremented by 1. More...
 
 getTranslation ($urlAlias, $languageCode)
 Returns translation in given $languageCode or null if it does not exist. More...
 
 historize ($urlAlias, $languageCode)
 Creates history for one translation. More...
 
 historizeAndUpdateExistingAlias ($data, $existingAlias, $languageCode, $name, $alwaysAvailable)
 Updates existing location alias and creates history if necessary. More...
 
 loadAlias ($parentId, $text)
 Loads alias by given $parentId and $text. More...
 
 loadAutogeneratedAlias ($locationId, $parentId=null)
 Loads autogenerated location alias for given $locationId, optionally limited by given $parentId. More...
 

Protected Attributes

 $backend
 
 $handler
 

Detailed Description

See Also
eZ

Constructor & Destructor Documentation

eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::__construct ( Handler  $handler,
Backend  $backend 
)

Setups current handler instance with reference to Handler object that created it.

Parameters
Handler$handler
Backend$backendThe storage engine backend

Member Function Documentation

eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::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\InMemory\UrlAliasHandler::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\InMemory\UrlAliasHandler::createNewAlias (   $linkId,
  $data,
  $languageCode,
  $name,
  $alwaysAvailable 
)

Creates new alias.

Parameters
mixed$linkId
array$data
string$languageCode
string$name
boolean$alwaysAvailable
Returns
void

Referenced by eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler\publishUrlAliasForLocation().

eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::createUrlAlias (   $resource,
  $path,
  $forwarding = false,
  $languageCode = null,
  $alwaysAvailable = false 
)
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$resource
string$path
boolean$forwarding
string | null$languageCode
boolean$alwaysAvailable
Returns
With $type = URLAlias::RESOURCE

Referenced by eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler\createCustomUrlAlias(), and eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler\createGlobalUrlAlias().

eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::downgrade (   $urlAlias,
  $languageCode 
)
protected

Remove translation in given $languageCode from alias or delete alias if given translation is the last one.

Parameters
\eZ\Publish\SPI\Persistence\Content\UrlAlias$urlAlias
string$languageCode
Returns
void

Referenced by eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler\createUrlAlias(), and eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler\publishUrlAliasForLocation().

eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::expandAlias (   $alias)
protected

Expands given $alias to array of new aliases for each different translation.

Parameters
\eZ\Publish\SPI\Persistence\Content\UrlAlias$alias
Returns
array

Referenced by eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler\listURLAliasesForLocation().

eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::getHash (   $text)
protected
eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::getNextLinkId ( )
protected
eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::getTranslation (   $urlAlias,
  $languageCode 
)
protected

Returns translation in given $languageCode or null if it does not exist.

Parameters
\eZ\Publish\SPI\Persistence\Content\UrlAlias$urlAlias
string$languageCode
Returns
string|null

Referenced by eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler\historizeAndUpdateExistingAlias().

eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::historize (   $urlAlias,
  $languageCode 
)
protected

Creates history for one translation.

Parameters
\eZ\Publish\SPI\Persistence\Content\UrlAlias$urlAlias
string$languageCode
Returns
void

Referenced by eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler\historizeAndUpdateExistingAlias().

eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::historizeAndUpdateExistingAlias (   $data,
  $existingAlias,
  $languageCode,
  $name,
  $alwaysAvailable 
)
protected

Updates existing location alias and creates history if necessary.

Parameters
array$data
\eZ\Publish\SPI\Persistence\Content\UrlAlias$existingAlias
string$languageCode
string$name
boolean$alwaysAvailable
Returns
void

Referenced by eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler\publishUrlAliasForLocation().

eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::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\InMemory\UrlAliasHandler::listURLAliasesForLocation (   $locationId,
  $custom = false 
)

List of url entries of $urlType, 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\InMemory\UrlAliasHandler::loadAlias (   $parentId,
  $text 
)
protected

Loads alias by given $parentId and $text.

Parameters
mixed$parentId
string$text
Returns
|null

Referenced by eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler\createUrlAlias(), and eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler\publishUrlAliasForLocation().

eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::loadAutogeneratedAlias (   $locationId,
  $parentId = null 
)
protected

Loads autogenerated location alias for given $locationId, optionally limited by given $parentId.

Exceptions
\RuntimeException
Parameters
mixed$locationId
null$parentId
Returns
|null

Referenced by eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler\publishUrlAliasForLocation().

eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::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\InMemory\UrlAliasHandler::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\InMemory\UrlAliasHandler::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).

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$parentLocationIdIn case of empty( $parentLocationId ), threat as root
string$namethe new name computed by the name schema or url alias schema
string$languageCode
boolean$alwaysAvailable
Returns
void Does not return the UrlAlias created / updated with type URLAlias::LOCATION

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

eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::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\InMemory\UrlAliasHandler::$backend
protected
eZ\Publish\Core\Persistence\InMemory\UrlAliasHandler::$handler
protected

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