From bd1365f8ae84356daf9af36bd6ac45c86b9e188e Mon Sep 17 00:00:00 2001 From: Mark Story Date: Sun, 2 May 2010 00:29:35 -0400 Subject: [PATCH] Changing interactions inside Router so it doesn't need a CakeRequest object, makes changes to Router test not necessary. --- cake/dispatcher.php | 5 +++-- cake/libs/router.php | 12 +++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/cake/dispatcher.php b/cake/dispatcher.php index 6e7eb7027..7b47dfe73 100644 --- a/cake/dispatcher.php +++ b/cake/dispatcher.php @@ -242,10 +242,11 @@ class Dispatcher extends Object { extract($namedExpressions); include CONFIGS . 'routes.php'; - $request = Router::parse($request); + $params = Router::parse($request->url); + $request->addParams($params); if (!empty($additionalParams)) { - $request->params = array_merge($request->params, $additionalParams); + $request->addParams($additionalParams); } return $request; } diff --git a/cake/libs/router.php b/cake/libs/router.php index 0e1963d57..06eb7be1d 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -414,13 +414,12 @@ class Router { } /** - * Parses given URL and returns an array of controller, action and parameters - * taken from that URL. + * Parses given URL string. Returns 'routing' parametets for that url. * * @param string $url URL to be parsed * @return array Parsed elements from URL */ - public static function parse($request) { + public static function parse($url) { $self =& Router::getInstance(); if (!$self->__defaultsMapped && $self->__connectDefaults) { @@ -433,9 +432,6 @@ class Router { $r = $ext = null; - // add a leading / and split out the query string. - // seems like this could be done in CakeRequest - $url = $request->url; if ($url && strpos($url, '/') !== 0) { $url = '/' . $url; } @@ -487,9 +483,7 @@ class Router { if (!empty($ext) && !isset($out['url']['ext'])) { $out['url']['ext'] = $ext; } - - $request->addParams($out); - return $request; + return $out; } /**