Updated the default Cake routes to include a defaultRoute true flag to allow differentiation

Merge #3579 from davidyell/routing-markers onto 2.6

Fixes #3535
This commit is contained in:
David Yell 2014-05-27 12:18:53 +01:00 committed by mark_story
parent 2546b79c62
commit 1e3730c988

View file

@ -48,8 +48,8 @@ if ($plugins = CakePlugin::loaded()) {
$plugins[$key] = Inflector::underscore($value);
}
$pluginPattern = implode('|', $plugins);
$match = array('plugin' => $pluginPattern);
$shortParams = array('routeClass' => 'PluginShortRoute', 'plugin' => $pluginPattern);
$match = array('plugin' => $pluginPattern, 'defaultRoute' => true);
$shortParams = array('routeClass' => 'PluginShortRoute', 'plugin' => $pluginPattern, 'defaultRoute' => true);
foreach ($prefixes as $prefix) {
$params = array('prefix' => $prefix, $prefix => true);
@ -66,11 +66,11 @@ if ($plugins = CakePlugin::loaded()) {
foreach ($prefixes as $prefix) {
$params = array('prefix' => $prefix, $prefix => true);
$indexParams = $params + array('action' => 'index');
Router::connect("/{$prefix}/:controller", $indexParams);
Router::connect("/{$prefix}/:controller/:action/*", $params);
Router::connect("/{$prefix}/:controller", $indexParams, array('defaultRoute' => true));
Router::connect("/{$prefix}/:controller/:action/*", $params, array('defaultRoute' => true));
}
Router::connect('/:controller', array('action' => 'index'));
Router::connect('/:controller/:action/*');
Router::connect('/:controller', array('action' => 'index'), array('defaultRoute' => true));
Router::connect('/:controller/:action/*', array(), array('defaultRoute' => true));
$namedConfig = Router::namedConfig();
if ($namedConfig['rules'] === false) {
@ -79,3 +79,4 @@ if ($namedConfig['rules'] === false) {
unset($namedConfig, $params, $indexParams, $prefix, $prefixes, $shortParams, $match,
$pluginPattern, $plugins, $key, $value);