symfony API

sfRouting 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.

sfRouting class controls the generation and parsing of URLs.

Inheritence

sfPatternRouting  <  sfRouting

Method Summary

Method Details

  • clearRoutes ()

    Clears all current routes.

  • (array) filterParametersEvent ($event)

    $event An sfEvent instance

    Listens to the request.filter_parameters event.

    returns $parameters An array of parameters for the event

  • fixGeneratedUrl ()

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

    $name The route name
    $params The parameter values
    $absolute Whether to generate an absolute URL

    Generates a valid URLs for parameters.

    returns The generated URL

  • (sfCache) getCache ()

    Returns the routing cache object.

    returns A sfCache instance or null

  • (string) getCurrentInternalUri ($with_route_name)

    $with_route_name Whether to give an internal URI with the route name (@route) or with the module/action pair

    Gets the internal URI for the current request.

    returns The current internal URI

  • (string) getDefaultParameter ($key)

    $key The key

    Gets a default parameter.

    returns The value

  • (array) getDefaultParameters ()

    Gets the default parameters for URL generation.

    returns An array of default parameters

  • (array) getOptions ()

    Returns the options.

    returns An array of options

  • (array) getRoutes ()

    Gets the current compiled route array.

    returns The route array

  • (bool) hasRoutes ()

    Returns true if this instance has some routes.

  • initialize ($dispatcher, $cache, $options)

    $dispatcher An sfEventDispatcher instance
    $cache An sfCache instance
    $options An associative array of initialization options.

    Initializes this sfRouting instance.


    Available options:

    * default_module: The default module name
    * default_action: The default action name
    * logging: Whether to log or not (false by default)
    * debug: Whether to cache or not (false by default)
    * context: An array of context variables to help URL matching and generation

  • listenToChangeCultureEvent ($event)

    $event An sfEvent instance

    Listens to the user.change_culture event.

  • loadConfiguration ()

    Loads routing configuration.


    This methods notifies a routing.load_configuration event.

  • (array|false) parse ($url)

    $url URL to be parsed

    Parses a URL to find a matching route and sets internal state.


    Returns false if no route match the URL.

    returns An array of parameters or false if the route does not match

  • setDefaultParameter ($key, $value)

    $key The key
    $value The value

    Sets a default parameter.

  • setDefaultParameters ($parameters)

    $parameters An array of default parameters

    Sets the default parameters for URL generation.

  • (array) setRoutes ($routes)

    $routes The route array

    Sets the compiled route array.

    returns The route array

  • (void) shutdown ()

    Execute the shutdown procedure.

  • __construct ()

    Class constructor.