symfony API

sfRoute Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.2 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.2 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) Browse code

    $context The context
    $parameters The parameters

    Binds the current route for a given context and parameters.

  • compile () Browse code

    Compiles the current route instance.

  • compileForSeparator ($separator, $regexSeparator) Browse code

    $separator
    $regexSeparator

  • compileForText ($separator, $text) Browse code

    $separator
    $text

  • compileForVariable ($separator, $name, $variable) Browse code

    $separator
    $name
    $variable

  • fixDefaults () Browse code

  • fixRequirements () Browse code

  • fixSuffix () Browse code

  • (string) generate ($params, $context = array(), (Boolean) $absolute = false) Browse code

    $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 ($url, $defaults, $parameters) Browse code

    $url
    $defaults
    $parameters

  • generateWithTokens ($parameters) Browse code

    $parameters An array of parameters

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

  • getDefaultOptions () Browse code

  • getDefaultParameters () Browse code

  • (array) getDefaults () Browse code

    Returns the compiled defaults.

    returns The compiled defaults

  • (array) getOptions () Browse code

    Returns the compiled options.

    returns The compiled options

  • (string) getPattern () Browse code

    Returns the compiled pattern.

    returns The compiled pattern

  • (string) getRegex () Browse code

    Returns the compiled regex.

    returns The compiled regex

  • (array) getRequirements () Browse code

    Returns the compiled requirements.

    returns The compiled requirements

  • (array) getTokens () Browse code

    Returns the compiled tokens.

    returns The compiled tokens

  • (array) getVariables () Browse code

    Returns the compiled variables.

    returns The compiled variables

  • hasStarParameter () Browse code

  • initializeOptions () Browse code

  • (Boolean) isBound () Browse code

    Returns true if the form is bound to input values.

    returns true if the form is bound to input values, false otherwise

  • (Boolean) matchesParameters ($params, $context = array()) Browse code

    $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 = array()) Browse code

    $url The URL
    $context The context

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

    returns An array of parameters

  • mergeArrays ($arr1, $arr2) Browse code

    $arr1
    $arr2

  • parseStarParameter ($star) Browse code

    $star

  • postCompile () Browse code

    Post-compiles a route.

  • preCompile () Browse code

    Pre-compiles a route.

  • serialize () Browse code

  • setDefaultOptions ($options) Browse code

    $options

  • setDefaultParameters ($parameters) Browse code

    $parameters

  • tokenize () Browse code

    Tokenizes the route.

  • (Boolean) tokenizeBufferAfter (&$buffer, &$tokens, &$afterASeparator, &$currentSeparator, $buffer, $tokens, (Boolean) $afterASeparator, $currentSeparator) Browse code

    &$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, $tokens, (Boolean) $afterASeparator, $currentSeparator) Browse code

    &$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 ($data) Browse code

    $data

  • __construct ($pattern, $defaults = array(), $requirements = array(), $options = array()) Browse code

    $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