eZPublishCommunityProject  2013.4
eZ\Publish\Core\Repository\URLAliasService Class Reference
+ Inheritance diagram for eZ\Publish\Core\Repository\URLAliasService:
+ Collaboration diagram for eZ\Publish\Core\Repository\URLAliasService:

Public Member Functions

 __construct (RepositoryInterface $repository, Handler $urlAliasHandler, array $settings=array())
 Setups service with reference to repository object that created it & corresponding handler. More...
 
 createGlobalUrlAlias ($resource, $path, $languageCode, $forwarding=false, $alwaysAvailable=false)
 Create a user chosen $alias pointing to a resource in $languageCode. More...
 
 createUrlAlias (Location $location, $path, $languageCode, $forwarding=false, $alwaysAvailable=false)
 Create a user chosen $alias pointing to $location in $languageCode. More...
 
 listGlobalAliases ($languageCode=null, $offset=0, $limit=-1)
 List global aliases. More...
 
 listLocationAliases (Location $location, $custom=true, $languageCode=null)
 List of url aliases pointing to $location, sorted by language priority. More...
 
 load ($id)
 Loads URL alias by given $id. More...
 
 lookup ($url, $languageCode=null)
 looks up the URLAlias for the given url. More...
 
 removeAliases (array $aliasList)
 Removes urls aliases. More...
 
 reverseLookup (Location $location, $languageCode=null)
 Returns the URL alias for the given location in the given language. More...
 

Protected Member Functions

 buildSPIUrlAlias (URLAlias $urlAlias)
 Builds persistence domain object. More...
 
 buildUrlAliasDomainObject (SPIURLAlias $spiUrlAlias, $path)
 Builds API UrlAlias object from given SPI UrlAlias object. More...
 
 choosePrioritizedLanguageCode (array $entries)
 Returns language code with highest priority. More...
 
 cleanUrl ($url)
 
 extractPath (SPIURLAlias $spiUrlAlias, $languageCode)
 Returns path extracted from normalized path data returned from persistence, using language settings. More...
 
 isPathLoadable (array $pathData, array $languageCodes)
 Returns true or false depending if URL alias is loadable or not for language settings in place. More...
 
 isUrlAliasLoadable (SPIURLAlias $spiUrlAlias, $languageCode)
 Returns true or false depending if URL alias is loadable or not for language settings in place. More...
 
 matchLanguageCode (array $pathElementData, $pathElement)
 
 matchPath (SPIURLAlias $spiUrlAlias, $path, $languageCode)
 Matches path string with normalized path data returned from persistence. More...
 
 selectAliasLanguageCode (SPIURLAlias $spiUrlAlias, $languageCode)
 Determines alias language code. More...
 

Protected Attributes

 $repository
 
 $settings
 
 $urlAliasHandler
 

Constructor & Destructor Documentation

eZ\Publish\Core\Repository\URLAliasService::__construct ( RepositoryInterface  $repository,
Handler  $urlAliasHandler,
array  $settings = array() 
)

Setups service with reference to repository object that created it & corresponding handler.

Parameters
\eZ\Publish\API\Repository\Repository$repository
\eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler$urlAliasHandler
array$settings

Member Function Documentation

eZ\Publish\Core\Repository\URLAliasService::buildSPIUrlAlias ( URLAlias  $urlAlias)
protected

Builds persistence domain object.

Parameters
\eZ\Publish\API\Repository\Values\Content\URLAlias$urlAlias
Returns

Referenced by eZ\Publish\Core\Repository\URLAliasService\removeAliases().

eZ\Publish\Core\Repository\URLAliasService::buildUrlAliasDomainObject ( SPIURLAlias  $spiUrlAlias,
  $path 
)
protected
eZ\Publish\Core\Repository\URLAliasService::choosePrioritizedLanguageCode ( array  $entries)
protected

Returns language code with highest priority.

Will return false if language code could nto be matched with language settings in place.

Parameters
array$entries
Returns
string|boolean

Referenced by eZ\Publish\Core\Repository\URLAliasService\extractPath().

eZ\Publish\Core\Repository\URLAliasService::cleanUrl (   $url)
protected
eZ\Publish\Core\Repository\URLAliasService::createGlobalUrlAlias (   $resource,
  $path,
  $languageCode,
  $forwarding = false,
  $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. This method runs URL filters and and transformers before storing them. Hence the path returned in the URLAlias Value may differ from the given.

$alwaysAvailable makes the alias available in all languages.

Exceptions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the path already exists for the given language or if resource is not valid
Parameters
string$resource
string$path
string$languageCode
boolean$forwarding
boolean$alwaysAvailable
Returns

Implements eZ\Publish\API\Repository\URLAliasService.

eZ\Publish\Core\Repository\URLAliasService::createUrlAlias ( Location  $location,
  $path,
  $languageCode,
  $forwarding = false,
  $alwaysAvailable = false 
)

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

This method runs URL filters and transformers before storing them. Hence the path returned in the URLAlias Value may differ from the given. $alwaysAvailable makes the alias available in all languages.

Parameters
\eZ\Publish\API\Repository\Values\Content\Location$location
string$path
boolean$forwardingif true a redirect is performed
string$languageCodethe languageCode for which this alias is valid
boolean$alwaysAvailable
Exceptions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the path already exists for the given language
Returns

Implements eZ\Publish\API\Repository\URLAliasService.

Referenced by eZ\Publish\Core\Repository\URLAliasService\createGlobalUrlAlias().

eZ\Publish\Core\Repository\URLAliasService::extractPath ( SPIURLAlias  $spiUrlAlias,
  $languageCode 
)
protected

Returns path extracted from normalized path data returned from persistence, using language settings.

Will return false if path could not be determined.

Parameters
\eZ\Publish\SPI\Persistence\Content\URLAlias$spiUrlAlias
string$languageCode
Returns
string|boolean

Referenced by eZ\Publish\Core\Repository\URLAliasService\listGlobalAliases(), eZ\Publish\Core\Repository\URLAliasService\listLocationAliases(), and eZ\Publish\Core\Repository\URLAliasService\load().

eZ\Publish\Core\Repository\URLAliasService::isPathLoadable ( array  $pathData,
array  $languageCodes 
)
protected

Returns true or false depending if URL alias is loadable or not for language settings in place.

Parameters
array$pathData
array$languageCodes
Returns
boolean

Referenced by eZ\Publish\Core\Repository\URLAliasService\lookup().

eZ\Publish\Core\Repository\URLAliasService::isUrlAliasLoadable ( SPIURLAlias  $spiUrlAlias,
  $languageCode 
)
protected

Returns true or false depending if URL alias is loadable or not for language settings in place.

Parameters
\eZ\Publish\SPI\Persistence\Content\URLAlias$spiUrlAlias
string | null$languageCode
Returns
boolean

Referenced by eZ\Publish\Core\Repository\URLAliasService\listLocationAliases().

eZ\Publish\Core\Repository\URLAliasService::listGlobalAliases (   $languageCode = null,
  $offset = 0,
  $limit = -1 
)

List global aliases.

Parameters
string$languageCodefilters those which are valid for the given language
int$offset
int$limit
Returns
[]

Implements eZ\Publish\API\Repository\URLAliasService.

eZ\Publish\Core\Repository\URLAliasService::listLocationAliases ( Location  $location,
  $custom = true,
  $languageCode = null 
)

List of url aliases pointing to $location, sorted by language priority.

Parameters
\eZ\Publish\API\Repository\Values\Content\Location$location
boolean$customif true the user generated aliases are listed otherwise the autogenerated
string$languageCodefilters those which are valid for the given language
Returns
[]

Implements eZ\Publish\API\Repository\URLAliasService.

Referenced by eZ\Publish\Core\Repository\URLAliasService\reverseLookup().

eZ\Publish\Core\Repository\URLAliasService::load (   $id)

Loads URL alias by given $id.

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

Implements eZ\Publish\API\Repository\URLAliasService.

eZ\Publish\Core\Repository\URLAliasService::lookup (   $url,
  $languageCode = null 
)

looks up the URLAlias for the given url.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif the path does not exist or is not valid for the given language
Parameters
string$url
string$languageCode
Returns

Implements eZ\Publish\API\Repository\URLAliasService.

eZ\Publish\Core\Repository\URLAliasService::matchLanguageCode ( array  $pathElementData,
  $pathElement 
)
protected
Parameters
array$pathElementData
string$pathElement
Returns
string|boolean

Referenced by eZ\Publish\Core\Repository\URLAliasService\matchPath().

eZ\Publish\Core\Repository\URLAliasService::matchPath ( SPIURLAlias  $spiUrlAlias,
  $path,
  $languageCode 
)
protected

Matches path string with normalized path data returned from persistence.

Returns matched path string (possibly case corrected) and array of corresponding language codes or false if path could not be matched.

Parameters
\eZ\Publish\SPI\Persistence\Content\URLAlias$spiUrlAlias
string$path
string$languageCode
Returns
array

Referenced by eZ\Publish\Core\Repository\URLAliasService\lookup().

eZ\Publish\Core\Repository\URLAliasService::removeAliases ( array  $aliasList)

Removes urls aliases.

This method does not remove autogenerated aliases for locations.

Exceptions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif alias list contains autogenerated alias
Parameters
\eZ\Publish\API\Repository\Values\Content\URLAlias[]$aliasList
Returns
void

Implements eZ\Publish\API\Repository\URLAliasService.

eZ\Publish\Core\Repository\URLAliasService::reverseLookup ( Location  $location,
  $languageCode = null 
)

Returns the URL alias for the given location in the given language.

If $languageCode is null the method returns the url alias in the most prioritized language.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif no url alias exist for the given language
Parameters
\eZ\Publish\API\Repository\Values\Content\Location$location
string$languageCode
Returns

Implements eZ\Publish\API\Repository\URLAliasService.

eZ\Publish\Core\Repository\URLAliasService::selectAliasLanguageCode ( SPIURLAlias  $spiUrlAlias,
  $languageCode 
)
protected

Determines alias language code.

Method will return false if language code can't be matched against alias language codes or language settings.

Parameters
\eZ\Publish\SPI\Persistence\Content\URLAlias$spiUrlAlias
string | null$languageCode
Returns
string|boolean

Referenced by eZ\Publish\Core\Repository\URLAliasService\extractPath(), and eZ\Publish\Core\Repository\URLAliasService\matchPath().

Member Data Documentation

eZ\Publish\Core\Repository\URLAliasService::$repository
protected
eZ\Publish\Core\Repository\URLAliasService::$settings
protected
eZ\Publish\Core\Repository\URLAliasService::$urlAliasHandler
protected

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