Router::reverse now removes models and paging keys that controllers can insert into params arrays.

This commit is contained in:
Mark Story 2009-12-28 13:34:05 -05:00
parent 5b78a662e8
commit df8914b2e4
2 changed files with 4 additions and 2 deletions

View file

@ -994,7 +994,7 @@ class Router {
$pass = $params['pass'];
$named = $params['named'];
$url = $params['url'];
unset($params['pass'], $params['named'], $params['url'], $url['url']);
unset($params['pass'], $params['named'], $params['paging'], $params['models'], $params['url'], $url['url']);
$params = array_merge($params, $pass, $named);
if (!empty($url)) {
$params['?'] = $url;

View file

@ -1987,7 +1987,9 @@ class RouterTest extends CakeTestCase {
'action' => 'view',
'pass' => array(1),
'named' => array(),
'url' => array('url' => 'eng/posts/view/1', 'foo' => 'bar', 'baz' => 'quu')
'url' => array('url' => 'eng/posts/view/1', 'foo' => 'bar', 'baz' => 'quu'),
'paging' => array(),
'models' => array()
);
$result = Router::reverse($params);
$this->assertEqual($result, '/eng/posts/view/1?foo=bar&baz=quu');