symfony API

sfRoute Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

Packages

You are currently browsing the symfony API for the 1.4 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

sfRoute represents a route.

Inheritence

sfRequestRoute  <  sfRoute

Method Summary

Method Details

  • bind ($context, $parameters)

    $context The context
    $parameters The parameters

    Binds the current route for a given context and parameters.

  • compile ()

    Compiles the current route instance.

  • compileForSeparator ()

  • compileForText ()

  • compileForVariable ()

  • fixDefaults ()

  • fixRequirements ()

  • fixSuffix ()

  • (string) generate ($params, $context, $absolute)

    $params The parameter values
    $context The context
    $absolute Whether to generate an absolute URL

    Generates a URL from the given parameters.

    returns The generated URL

  • generateStarParameter ()

  • generateWithTokens ($parameters)

    $parameters An array of parameters

    Generates a URL for the given parameters by using the route tokens.

  • getDefaultOptions ()

  • getDefaultParameters ()

  • (array) getDefaults ()

    Returns the compiled defaults.

    returns The compiled defaults

  • (array) getOptions ()

    Returns the compiled options.

    returns The compiled options

  • (array) getParameters ()

    Returns the route parameters.

    returns The route parameters

  • (string) getPattern ()

    Returns the compiled pattern.

    returns The compiled pattern

  • (string) getRegex ()

    Returns the compiled regex.

    returns The compiled regex

  • (array) getRequirements ()

    Returns the compiled requirements.

    returns The compiled requirements

  • (array) getTokens ()

    Returns the compiled tokens.

    returns The compiled tokens

  • (array) getVariables ()

    Returns the compiled variables.

    returns The compiled variables

  • hasStarParameter ()

  • initializeOptions ()

  • (Boolean) isBound ()

    Returns true if the route is bound to context and parameters.

    returns true if theroute is bound to context and parameters, false otherwise

  • (Boolean) matchesParameters ($params, $context)

    $params The parameters
    $context The context

    Returns true if the parameters matches this route, false otherwise.

    returns true if the parameters matches this route, false otherwise.

  • (array) matchesUrl ($url, $context)

    $url The URL
    $context The context

    Returns an array of parameters if the URL matches this route, false otherwise.

    returns An array of parameters

  • mergeArrays ()

  • parseStarParameter ()

  • postCompile ()

    Post-compiles a route.

  • preCompile ()

    Pre-compiles a route.

  • serialize ()

  • setDefaultOptions ()

  • setDefaultParameters ()

  • tokenize ()

    Tokenizes the route.

  • (Boolean) tokenizeBufferAfter ($buffer, $tokens, $afterASeparator, $currentSeparator)

    $buffer The current route buffer
    $tokens An array of current tokens
    $afterASeparator Whether the buffer is just after a separator
    $currentSeparator The last matched separator

    Tokenizes the buffer after default logic is applied.


    This method must return false if the buffer has not been parsed.

    returns true if a token has been generated, false otherwise

  • (Boolean) tokenizeBufferBefore ($buffer, $tokens, $afterASeparator, $currentSeparator)

    $buffer The current route buffer
    $tokens An array of current tokens
    $afterASeparator Whether the buffer is just after a separator
    $currentSeparator The last matched separator

    Tokenizes the buffer before default logic is applied.


    This method must return false if the buffer has not been parsed.

    returns true if a token has been generated, false otherwise

  • unserialize ()

  • __construct ($pattern, $defaults, $requirements, $options)

    $pattern The pattern to match
    $defaults An array of default parameter values
    $requirements An array of requirements for parameters (regexes)
    $options An array of options

    Constructor.


    Available options:

    * variable_prefixes: An array of characters that starts a variable name (: by default)
    * segment_separators: An array of allowed characters for segment separators (/ and . by default)
    * variable_regex: A regex that match a valid variable name ([\w\d_]+ by default)
    * generate_shortest_url: Whether to generate the shortest URL possible (true by default)
    * extra_parameters_as_query_string: Whether to generate extra parameters as a query string