From a727fba108e213ca3d75099b7047726deff9b71c Mon Sep 17 00:00:00 2001 From: Aldo Date: Fri, 11 Jul 2014 12:27:36 +0200 Subject: [PATCH 1/2] adds redirectTo method Adds method `redirectTo` which is a shortcut for `redirect(urlfor(..))` Helps making the code more readable by encapsulating a common pattern. --- Slim/Slim.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Slim/Slim.php b/Slim/Slim.php index cb8ef664b..0ee9879e5 100644 --- a/Slim/Slim.php +++ b/Slim/Slim.php @@ -1099,6 +1099,18 @@ public function redirect($url, $status = 302) $this->response->redirect($url, $status); $this->halt($status); } + + /** + * RedirectTo + * + * Redirects to a specific named route + * + * @param string $url The route name + * @param array $params Associative array of URL parameters and replacement values + */ + public function redirectTo($route, $params = array(), $status = 302){ + $this->redirect($this->urlFor($route, $params), $status); + } /******************************************************************************** * Flash Messages From 7011de3ec866d978a7a0bc7dc9727deb536436f9 Mon Sep 17 00:00:00 2001 From: Aldo Date: Tue, 15 Jul 2014 15:07:36 +0200 Subject: [PATCH 2/2] fixed phpdoc --- Slim/Slim.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Slim/Slim.php b/Slim/Slim.php index 0ee9879e5..c2de8b491 100644 --- a/Slim/Slim.php +++ b/Slim/Slim.php @@ -1105,7 +1105,7 @@ public function redirect($url, $status = 302) * * Redirects to a specific named route * - * @param string $url The route name + * @param string $route The route name * @param array $params Associative array of URL parameters and replacement values */ public function redirectTo($route, $params = array(), $status = 302){