Class UrlGenerator
UrlGenerator can generate a URL or a path for any route in the RouteCollection based on the passed parameters.
- Symfony\Component\Routing\Generator\UrlGenerator implements Symfony\Component\Routing\Generator\UrlGeneratorInterface, Symfony\Component\Routing\Generator\ConfigurableRequirementsInterface
Namespace: Symfony\Component\Routing\Generator
Author: Fabien Potencier <fabien@symfony.com>
Author: Tobias Schultze <http://tobion.de>
Located at Generator/UrlGenerator.php
Author: Fabien Potencier <fabien@symfony.com>
Author: Tobias Schultze <http://tobion.de>
Located at Generator/UrlGenerator.php
public
|
#
__construct(
Constructor. |
public
|
|
public
|
|
public
|
#
setStrictRequirements( boolean|null $enabled )
Enables or disables the exception on incorrect parameters. Passing null will deactivate the requirements check completely. |
public
boolean|null
|
#
isStrictRequirements( )
Returns whether to throw an exception on incorrect parameters. Null means the requirements check is deactivated completely. |
public
string
|
#
generate( string $name, mixed $parameters = array(), integer $referenceType =
Generates a URL or path for a specific route based on the given parameters. |
protected
|
#
doGenerate( mixed $variables, mixed $defaults, mixed $requirements, mixed $tokens, mixed $parameters, mixed $name, mixed $referenceType, mixed $hostTokens, array $requiredSchemes = array() )
|
public static
string
|
#
getRelativePath( string $basePath, string $targetPath )
Returns the target path as relative reference from the base path. |
ABSOLUTE_PATH,
ABSOLUTE_URL,
NETWORK_PATH,
RELATIVE_PATH
|
protected
|
$routes | |
|
protected
|
$context | |
|
protected
boolean|null
|
$strictRequirements | true |
|
protected
Psr\Log\LoggerInterface|null
|
$logger | |
|
protected
array
|
$decodedChars | array(
// the slash can be used to designate a hierarchical structure and we want allow using it with this meaning
// some webservers don't allow the slash in encoded form in the path for security reasons anyway
// see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss
'%2F' => '/',
// the following chars are general delimiters in the URI specification but have only special meaning in the authority component
// so they can safely be used in the path in unencoded form
'%40' => '@',
'%3A' => ':',
// these chars are only sub-delimiters that have no predefined meaning and can therefore be used literally
// so URI producing applications can use these chars to delimit subcomponents in a path segment without being encoded for better readability
'%3B' => ';',
'%2C' => ',',
'%3D' => '=',
'%2B' => '+',
'%21' => '!',
'%2A' => '*',
'%7C' => '|',
) |
#
This array defines the characters (besides alphanumeric ones) that will not be percent-encoded in the path segment of the generated URL. |