Example #1
0
 /**
  * Connects a new route to some URL pattern.
  * URLPattern might have "variables", which has a ":" at the beggining. e.x. ":action"
  *
  * E.x.:
  * <code>
  * $router->connect(":controller/:action/:id", array(), array("id" => "[0-9]+"));
  * </code>
  *
  * The route above will map to following URL's:
  * item/add/34
  * post/view/9233
  *
  * But not to these:
  * item/add/AC331
  * post/view
  *
  * URLPattern variables :controller :action :id by default might have value from
  * a range [_.a-zA-Z0-9]. When you pass array("id" => "[0-9]") as varRequirements
  * id is required to be only numeric.
  *
  * Routes are evaluated (mapToRoute(), createUrl() functions) in the order they were
  * added. To add a route to the beginning of the route list, use connectPriority()
  *
  * @link http://www.symfony-project.com/book/trunk/routing
  *
  * @param string $routeDefinitionPattern
  * @param array $paramValueAssigments
  * @param array $paramValueRequirements
  *
  */
 public function connect($routeDefinitionPattern, $paramValueAssigments = array(), $paramValueRequirements = array())
 {
     $route = new Route($routeDefinitionPattern, $paramValueAssigments, $paramValueRequirements);
     $this->routeListByParamCount[count($route->getParamList())][] = $route;
     $this->routeList[] = $route;
 }