symfony API

sfPatternRouting Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to API menu


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.

sfPatternRouting class controls the generation and parsing of URLs.


sfPatternRouting  <  sfRouting

Method Summary

Methods inherited from sfRouting

clearRoutes , filterParametersEvent , fixGeneratedUrl , generate , getCache , getCurrentInternalUri , getDefaultParameter , getDefaultParameters , getOptions , getRoutes , hasRoutes , initialize , listenToChangeCultureEvent , loadConfiguration , parse , setDefaultParameter , setDefaultParameters , setRoutes , shutdown , __construct

Method Details

  • appendRoute ()

    Adds a new route.

    Alias for the connect method.

  • clearRoutes ()

    @see sfRouting

  • configureRoute ()

  • (array) connect ($name, $route)

    $name The route name
    $route A sfRoute instance

    Adds a new route at the end of the current list of routes.

    A route string is a string with 2 special constructions:
    - :string: :string denotes a named parameter (available later as $request->getParameter('string'))
    - *: * match an indefinite number of parameters in a route

    Here is a very common rule in a symfony project:

    $r->connect('default', new sfRoute('/:module/:action/*'));

    returns current routes

  • ensureDefaultParametersAreSet ()

    Added for better performance. We need to ensure that changed default parameters

    are set, but resetting them everytime wastes many cpu cycles

  • (array|false) findRoute ($url)

    $url URL to be parsed

    Finds a matching route for given URL.

    Returns false if no route matches.

    Returned array contains:

    - name: name or alias of the route that matched
    - pattern: the compiled pattern of the route that matched
    - parameters: array containing key value pairs of the request parameters including defaults

    returns An array with routing information or false if no route matched

  • flattenRoutes ()

  • generate ()

    @see sfRouting

  • getConfigFileName ()

  • getCurrentInternalUri ()

    @see sfRouting

  • (string) getCurrentRouteName ()

    Gets the current route name.

    returns The route name

  • getRoutes ()

    @see sfRouting

  • getRouteThatMatchesParameters ()

  • getRouteThatMatchesUrl ()

  • (boolean) hasRouteName ($name)

    $name The route name

    Returns true if the route name given is defined.

  • hasRoutes ()

    @see sfRouting

  • initialize ()

    Initializes this Routing.

    Available options:

    * suffix: The default suffix
    * 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
    * lookup_cache_dedicated_keys: Whether to use dedicated keys for parse/generate cache (false by default)
    WARNING: When this option is activated, do not use sfFileCache; use a fast access
    cache backend (like sfAPCCache).

  • insertRouteBefore ()

    Adds a new route before a given one in the current list of routes.

  • loadConfiguration ()

    @see sfRouting

  • normalizeUrl ()

  • parse ()

    @see sfRouting

  • prependRoute ()

    Adds a new route at the beginning of the current list of routes.

  • setDefaultParameter ()

    @see sfRouting

  • setDefaultParameters ()

    @see sfRouting

  • setRoutes ()

    @see sfRouting

  • shutdown ()

    @see sfRouting

  • updateCurrentInternalUri ()