Permalink
Browse files

Workign with @jails on closing #671.

  • Loading branch information...
1 parent 6aeda32 commit 13bbeeb225db038c8dd0b9a5beee956cb5ed6bf4 @gwoo committed Nov 23, 2012
Showing with 5 additions and 18 deletions.
  1. +4 −18 net/http/Route.php
  2. +1 −0 tests/cases/net/http/RouteTest.php
View
22 net/http/Route.php
@@ -158,13 +158,6 @@ class Route extends \lithium\core\Object {
protected $_formatters = array();
/**
- * Boolean indicate if `'action'` has been defined in construct parameters.
- *
- * @var string
- */
- protected $_action = false;
-
- /**
* Auto configuration properties. Also used as the list of properties to return when exporting
* this `Route` object to an array.
*
@@ -198,7 +191,6 @@ protected function _init() {
parent::_init();
if (!$this->_config['continue']) {
- $this->_action = isset($this->_params['action']);
$this->_params += array('action' => 'index');
}
if (!$this->_config['pattern']) {
@@ -237,18 +229,15 @@ public function parse($request, array $options = array()) {
return false;
}
}
-
if (isset($match['args'])) {
$match['args'] = explode('/', $match['args']);
}
- if (isset($this->_keys['args'])) {
- $match += array('args' => array());
- }
- $result = array_intersect_key($match, $this->_keys) + $this->_params + $this->_defaults;
+ $result = array_filter(array_intersect_key($match, $this->_keys));
- if (isset($result['action']) && !$result['action']) {
- $result['action'] = 'index';
+ if (isset($this->_keys['args'])) {
+ $result += array('args' => array());
}
+ $result += $this->_params + $this->_defaults;
$request->params = $result + (array) $request->params;
$request->persist = array_unique(array_merge($request->persist, $this->_persist));
@@ -467,9 +456,6 @@ public function compile() {
protected function _regex($regex, $param, $token, $prefix) {
if ($regex) {
$this->_subPatterns[$param] = $regex;
- if (!$this->_action && $param == 'action') {
- unset($this->_params[$param]);
- }
} elseif ($param == 'args') {
$regex = '.*';
} else {
View
1 tests/cases/net/http/RouteTest.php
@@ -713,6 +713,7 @@ public function testRouteRouteParsingWithRegExAction() {
$this->assertEqual($expected, $result->params);
$route = new Route(array(
+ 'continue' => true,
'template' => '/products/{:action:add|edit|remove}/{:category}',
'params' => array('controller' => 'Products')
));

0 comments on commit 13bbeeb

Please sign in to comment.