PHP Class Neos\Flow\Mvc\Routing\UriBuilder

Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Свойство Type Description
$addQueryString boolean
$arguments array
$argumentsToBeExcludedFromQueryString array
$createAbsoluteUri boolean
$createRelativePaths boolean
$environment Neos\Flow\Utility\Environment
$format string
$lastArguments array Arguments which have been used for building the last URI
$request Neos\Flow\Mvc\ActionRequest
$router Neos\Flow\Mvc\Routing\RouterInterface
$section string

Méthodes publiques

Méthode Description
build ( array $arguments = [] ) : string Builds the URI
getAddQueryString ( ) : boolean
getArguments ( ) : array
getArgumentsToBeExcludedFromQueryString ( ) : array
getCreateAbsoluteUri ( ) : boolean
getCreateRelativePaths ( ) : boolean
getFormat ( ) : string
getLastArguments ( ) : array Returns the arguments being used for the last URI being built.
getRequest ( ) : ActionRequest Gets the current request
getSection ( ) : string
reset ( ) : UriBuilder Resets all UriBuilder options to their default value.
setAddQueryString ( boolean $addQueryString ) : UriBuilder If set, the current query parameters will be merged with $this->arguments. Defaults to FALSE.
setArguments ( array $arguments ) : UriBuilder Additional query parameters.
setArgumentsToBeExcludedFromQueryString ( array $argumentsToBeExcludedFromQueryString ) : UriBuilder A list of arguments to be excluded from the query parameters Only active if addQueryString is set
setCreateAbsoluteUri ( boolean $createAbsoluteUri ) : UriBuilder If set, the URI is prepended with the current base URI. Defaults to FALSE.
setCreateRelativePaths ( boolean $createRelativePaths ) : UriBuilder By default relative URIs are prefixed with the current script request path creating absolute paths starting with a slash If this is set to FALSE, relative paths are created as it used to be the default behavior before Flow 2.0.
setFormat ( string $format ) : UriBuilder Specifies the format of the target (e.g. "html" or "xml")
setRequest ( ActionRequest $request ) : void Sets the current request and resets the UriBuilder
setSection ( string $section ) : UriBuilder If specified, adds a given HTML anchor to the URI (#.
uriFor ( string $actionName, array $controllerArguments = [], string $controllerName = null, string $packageKey = null, string $subPackageKey = null ) : string Creates an URI used for linking to an Controller action.

Méthodes protégées

Méthode Description
addNamespaceToArguments ( array $arguments, Neos\Flow\Mvc\RequestInterface $currentRequest ) : array Adds the argument namespace of the current request to the specified arguments.
getRequestNamespacePath ( ActionRequest $request ) : string Get the path of the argument namespaces of all parent requests.
mergeArgumentsWithRequestArguments ( array $arguments ) : array Merges specified arguments with arguments from request.

Method Details

addNamespaceToArguments() protected méthode

This happens recursively iterating through the nested requests in case of a subrequest. For example if this is executed inside a widget sub request in a plugin sub request, the result would be: array( 'pluginRequestNamespace' => array( 'widgetRequestNamespace => $arguments ) )
protected addNamespaceToArguments ( array $arguments, Neos\Flow\Mvc\RequestInterface $currentRequest ) : array
$arguments array arguments
$currentRequest Neos\Flow\Mvc\RequestInterface
Résultat array arguments with namespace

build() public méthode

Builds the URI
public build ( array $arguments = [] ) : string
$arguments array optional URI arguments. Will be merged with $this->arguments with precedence to $arguments
Résultat string The URI

getAddQueryString() public méthode

public getAddQueryString ( ) : boolean
Résultat boolean

getArguments() public méthode

public getArguments ( ) : array
Résultat array

getArgumentsToBeExcludedFromQueryString() public méthode

getCreateAbsoluteUri() public méthode

public getCreateAbsoluteUri ( ) : boolean
Résultat boolean

getCreateRelativePaths() public méthode

public getCreateRelativePaths ( ) : boolean
Résultat boolean

getFormat() public méthode

public getFormat ( ) : string
Résultat string

getLastArguments() public méthode

This is only set after build() / uriFor() has been called.
public getLastArguments ( ) : array
Résultat array The last arguments

getRequest() public méthode

Gets the current request
public getRequest ( ) : ActionRequest
Résultat Neos\Flow\Mvc\ActionRequest

getRequestNamespacePath() protected méthode

Example: mainrequest.subrequest.subsubrequest
protected getRequestNamespacePath ( ActionRequest $request ) : string
$request Neos\Flow\Mvc\ActionRequest
Résultat string

getSection() public méthode

public getSection ( ) : string
Résultat string

mergeArgumentsWithRequestArguments() protected méthode

If $this->request is no sub request, request arguments will only be merged if $this->addQueryString is set. Otherwise all request arguments except for the ones prefixed with the current request argument namespace will be merged. Additionally special arguments (PackageKey, SubpackageKey, ControllerName & Action) are merged. The argument provided through the $arguments parameter always overrule the request arguments. The request hierarchy is structured as follows: root (HTTP) > main (Action) > sub (Action) > sub sub (Action)
protected mergeArgumentsWithRequestArguments ( array $arguments ) : array
$arguments array
Résultat array

reset() public méthode

Note: This won't reset the Request that is attached to this UriBuilder (@see setRequest())
public reset ( ) : UriBuilder
Résultat UriBuilder the current UriBuilder to allow method chaining

setAddQueryString() public méthode

If set, the current query parameters will be merged with $this->arguments. Defaults to FALSE.
public setAddQueryString ( boolean $addQueryString ) : UriBuilder
$addQueryString boolean
Résultat UriBuilder the current UriBuilder to allow method chaining

setArguments() public méthode

If you want to "prefix" arguments, you can pass in multidimensional arrays: array('prefix1' => array('foo' => 'bar')) gets "&prefix1[foo]=bar"
public setArguments ( array $arguments ) : UriBuilder
$arguments array
Résultat UriBuilder the current UriBuilder to allow method chaining

setArgumentsToBeExcludedFromQueryString() public méthode

A list of arguments to be excluded from the query parameters Only active if addQueryString is set
public setArgumentsToBeExcludedFromQueryString ( array $argumentsToBeExcludedFromQueryString ) : UriBuilder
$argumentsToBeExcludedFromQueryString array
Résultat UriBuilder the current UriBuilder to allow method chaining

setCreateAbsoluteUri() public méthode

If set, the URI is prepended with the current base URI. Defaults to FALSE.
public setCreateAbsoluteUri ( boolean $createAbsoluteUri ) : UriBuilder
$createAbsoluteUri boolean
Résultat UriBuilder the current UriBuilder to allow method chaining

setCreateRelativePaths() public méthode

By default relative URIs are prefixed with the current script request path creating absolute paths starting with a slash If this is set to FALSE, relative paths are created as it used to be the default behavior before Flow 2.0.
public setCreateRelativePaths ( boolean $createRelativePaths ) : UriBuilder
$createRelativePaths boolean
Résultat UriBuilder the current UriBuilder to allow method chaining

setFormat() public méthode

Specifies the format of the target (e.g. "html" or "xml")
public setFormat ( string $format ) : UriBuilder
$format string (e.g. "html" or "xml"), will be transformed to lowercase!
Résultat UriBuilder the current UriBuilder to allow method chaining

setRequest() public méthode

Sets the current request and resets the UriBuilder
See also: reset()
public setRequest ( ActionRequest $request ) : void
$request Neos\Flow\Mvc\ActionRequest
Résultat void

setSection() public méthode

..)
public setSection ( string $section ) : UriBuilder
$section string
Résultat UriBuilder the current UriBuilder to allow method chaining

uriFor() public méthode

Creates an URI used for linking to an Controller action.
See also: build()
public uriFor ( string $actionName, array $controllerArguments = [], string $controllerName = null, string $packageKey = null, string $subPackageKey = null ) : string
$actionName string Name of the action to be called
$controllerArguments array Additional query parameters. Will be merged with $this->arguments.
$controllerName string Name of the target controller. If not set, current ControllerName is used.
$packageKey string Name of the target package. If not set, current Package is used.
$subPackageKey string Name of the target SubPackage. If not set, current SubPackage is used.
Résultat string the rendered URI

Property Details

$addQueryString protected_oe property

protected bool $addQueryString
Résultat boolean

$arguments protected_oe property

protected array $arguments
Résultat array

$argumentsToBeExcludedFromQueryString protected_oe property

protected array $argumentsToBeExcludedFromQueryString
Résultat array

$createAbsoluteUri protected_oe property

protected bool $createAbsoluteUri
Résultat boolean

$createRelativePaths protected_oe property

protected bool $createRelativePaths
Résultat boolean

$environment protected_oe property

protected Environment,Neos\Flow\Utility $environment
Résultat Neos\Flow\Utility\Environment

$format protected_oe property

protected string $format
Résultat string

$lastArguments protected_oe property

Arguments which have been used for building the last URI
protected array $lastArguments
Résultat array

$request protected_oe property

protected ActionRequest,Neos\Flow\Mvc $request
Résultat Neos\Flow\Mvc\ActionRequest

$router protected_oe property

protected RouterInterface,Neos\Flow\Mvc\Routing $router
Résultat Neos\Flow\Mvc\Routing\RouterInterface

$section protected_oe property

protected string $section
Résultat string