symfony API

sfPatternRouting Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to API menu

1.1 API OpenSearch


You are currently browsing the symfony API for the 1.1 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 , fixDefaults , generate , getCurrentInternalUri , getRoutes , hasRoutes , initialize , listenToChangeCultureEvent , loadConfiguration , mergeArrays , parse , setDefaultParameter , setDefaultParameters , setRoutes , shutdown , __construct

Method Details

  • appendRoute () Browse code

    Adds a new route.

    Alias for the connect method.

  • clearRoutes () Browse code

    @see sfRouting

  • (array) connect ($name, $route, $defaults, $requirements) Browse code

    $name The route name
    $route The route string
    $defaults The default parameter values
    $requirements The regexps parameters must match

    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 paramater (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', '/:module/:action/*');

    returns current routes

  • (array) findRoute ($url) Browse code

    $url URL to be parsed

    Finds a matching route for given URL.

    Returned array contains:
    - name : name or alias of the route that matched
    - route : the actual matching route
    - parameters : array containing key value pairs of the request parameters including defaults

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

  • generate () Browse code

    @see sfRouting

  • getCurrentInternalUri () Browse code

    @see sfRouting

  • (string) getCurrentRouteName () Browse code

    Gets the current route name.

    returns The route name

  • getRoutes () Browse code

    @see sfRouting

  • (boolean) hasRouteName ($name) Browse code

    $name The route name

    Returns true if the route name given is defined.

  • hasRoutes () Browse code

    @see sfRouting

  • initialize () Browse code

    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)

  • insertRouteBefore () Browse code

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

  • loadConfiguration () Browse code

    @see sfRouting

  • parse () Browse code

    @see sfRouting

  • parseStarParameter () Browse code

  • prependRoute () Browse code

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

  • setDefaultSuffix () Browse code

    Sets the default suffix

  • setRoutes () Browse code

    @see sfRouting

  • shutdown () Browse code

    @see sfRouting