Skip to content

Commit

Permalink
Expand doc block for Router::connect().
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 9, 2012
1 parent 2a8ebce commit 9c9cc7f
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions lib/Cake/Routing/Router.php
Expand Up @@ -259,18 +259,28 @@ public static function resourceMap($resourceMap = null) {
* $options offers four 'special' keys. `pass`, `named`, `persist` and `routeClass`
* have special meaning in the $options array.
*
* `pass` is used to define which of the routed parameters should be shifted into the pass array. Adding a
* parameter to pass will remove it from the regular route array. Ex. `'pass' => array('slug')`
* - `pass` is used to define which of the routed parameters should be shifted into the pass array. Adding a
* parameter to pass will remove it from the regular route array. Ex. `'pass' => array('slug')`
* - `persist` is used to define which route parameters should be automatically included when generating
* new urls. You can override persistent parameters by redefining them in a url or remove them by
* setting the parameter to `false`. Ex. `'persist' => array('lang')`
* - `routeClass` is used to extend and change how individual routes parse requests and handle reverse routing,
* via a custom routing class. Ex. `'routeClass' => 'SlugRoute'`
* - `named` is used to configure named parameters at the route level. This key uses the same options
* as Router::connectNamed()
*
* `persist` is used to define which route parameters should be automatically included when generating
* new urls. You can override persistent parameters by redefining them in a url or remove them by
* setting the parameter to `false`. Ex. `'persist' => array('lang')`
* In addition to the 4 keys listed above, you can add additional conditions for matching routes.
* The following conditions can be used:
*
* `routeClass` is used to extend and change how individual routes parse requests and handle reverse routing,
* via a custom routing class. Ex. `'routeClass' => 'SlugRoute'`
* - `[type]` Only match requests for specific content types.

This comment has been minimized.

Copy link
@ADmad

ADmad Dec 15, 2012

Member

I noticed there are no test cases for [type] and [server].

This comment has been minimized.

Copy link
@markstory

markstory Dec 15, 2012

Author Member

Nope, probably should add some.

* - `[method]` Only match requests with specific HTTP verbs.
* - `[server]` Only match when $_SERVER['SERVER_NAME'] matches the given value.
*
* `named` is used to configure named parameters at the route level. This key uses the same options
* as Router::connectNamed()
* Example of using the `[method]` condition:
*
* `Router::connect('/tasks', array('controller' => 'tasks', 'action' => 'index'), array('[method]' => 'GET'));`
*
* The above route will only be matched for GET requests. POST requests will fail to match this route.
*
* @param string $route A string describing the template of the route
* @param array $defaults An array describing the default route parameters. These parameters will be used by default
Expand Down

0 comments on commit 9c9cc7f

Please sign in to comment.