PHP Класс Neos\Flow\Mvc\Routing\UriBuilder

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Описание методов

addNamespaceToArguments() защищенный Метод

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
Результат array arguments with namespace

build() публичный Метод

Builds the URI
public build ( array $arguments = [] ) : string
$arguments array optional URI arguments. Will be merged with $this->arguments with precedence to $arguments
Результат string The URI

getAddQueryString() публичный Метод

public getAddQueryString ( ) : boolean
Результат boolean

getArguments() публичный Метод

public getArguments ( ) : array
Результат array

getArgumentsToBeExcludedFromQueryString() публичный Метод

public getArgumentsToBeExcludedFromQueryString ( ) : array
Результат array

getCreateAbsoluteUri() публичный Метод

public getCreateAbsoluteUri ( ) : boolean
Результат boolean

getCreateRelativePaths() публичный Метод

public getCreateRelativePaths ( ) : boolean
Результат boolean

getFormat() публичный Метод

public getFormat ( ) : string
Результат string

getLastArguments() публичный Метод

This is only set after build() / uriFor() has been called.
public getLastArguments ( ) : array
Результат array The last arguments

getRequest() публичный Метод

Gets the current request
public getRequest ( ) : ActionRequest
Результат Neos\Flow\Mvc\ActionRequest

getRequestNamespacePath() защищенный Метод

Example: mainrequest.subrequest.subsubrequest
protected getRequestNamespacePath ( ActionRequest $request ) : string
$request Neos\Flow\Mvc\ActionRequest
Результат string

getSection() публичный Метод

public getSection ( ) : string
Результат string

mergeArgumentsWithRequestArguments() защищенный Метод

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
Результат array

reset() публичный Метод

Note: This won't reset the Request that is attached to this UriBuilder (@see setRequest())
public reset ( ) : UriBuilder
Результат UriBuilder the current UriBuilder to allow method chaining

setAddQueryString() публичный Метод

If set, the current query parameters will be merged with $this->arguments. Defaults to FALSE.
public setAddQueryString ( boolean $addQueryString ) : UriBuilder
$addQueryString boolean
Результат UriBuilder the current UriBuilder to allow method chaining

setArguments() публичный Метод

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
Результат UriBuilder the current UriBuilder to allow method chaining

setArgumentsToBeExcludedFromQueryString() публичный Метод

A list of arguments to be excluded from the query parameters Only active if addQueryString is set
public setArgumentsToBeExcludedFromQueryString ( array $argumentsToBeExcludedFromQueryString ) : UriBuilder
$argumentsToBeExcludedFromQueryString array
Результат UriBuilder the current UriBuilder to allow method chaining

setCreateAbsoluteUri() публичный Метод

If set, the URI is prepended with the current base URI. Defaults to FALSE.
public setCreateAbsoluteUri ( boolean $createAbsoluteUri ) : UriBuilder
$createAbsoluteUri boolean
Результат UriBuilder the current UriBuilder to allow method chaining

setCreateRelativePaths() публичный Метод

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
Результат UriBuilder the current UriBuilder to allow method chaining

setFormat() публичный Метод

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!
Результат UriBuilder the current UriBuilder to allow method chaining

setRequest() публичный Метод

Sets the current request and resets the UriBuilder
См. также: reset()
public setRequest ( ActionRequest $request ) : void
$request Neos\Flow\Mvc\ActionRequest
Результат void

setSection() публичный Метод

..)
public setSection ( string $section ) : UriBuilder
$section string
Результат UriBuilder the current UriBuilder to allow method chaining

uriFor() публичный Метод

Creates an URI used for linking to an Controller action.
См. также: 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.
Результат string the rendered URI

Описание свойств

$addQueryString защищенное свойство

protected bool $addQueryString
Результат boolean

$arguments защищенное свойство

protected array $arguments
Результат array

$argumentsToBeExcludedFromQueryString защищенное свойство

protected array $argumentsToBeExcludedFromQueryString
Результат array

$createAbsoluteUri защищенное свойство

protected bool $createAbsoluteUri
Результат boolean

$createRelativePaths защищенное свойство

protected bool $createRelativePaths
Результат boolean

$environment защищенное свойство

protected Environment,Neos\Flow\Utility $environment
Результат Neos\Flow\Utility\Environment

$format защищенное свойство

protected string $format
Результат string

$lastArguments защищенное свойство

Arguments which have been used for building the last URI
protected array $lastArguments
Результат array

$request защищенное свойство

protected ActionRequest,Neos\Flow\Mvc $request
Результат Neos\Flow\Mvc\ActionRequest

$router защищенное свойство

protected RouterInterface,Neos\Flow\Mvc\Routing $router
Результат Neos\Flow\Mvc\Routing\RouterInterface

$section защищенное свойство

protected string $section
Результат string