From 61343ccb4b783778b3410d1fcb47d2e4eafe6119 Mon Sep 17 00:00:00 2001 From: Patrick Conroy Date: Tue, 31 Jan 2017 11:27:25 -0500 Subject: [PATCH] Make it possible to define a custom routeClass for builder redirects --- src/Routing/RouteBuilder.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Routing/RouteBuilder.php b/src/Routing/RouteBuilder.php index c482a87621a..84795780629 100644 --- a/src/Routing/RouteBuilder.php +++ b/src/Routing/RouteBuilder.php @@ -798,7 +798,7 @@ protected function _makeRoute($route, $defaults, $options) * * - `status` Sets the HTTP status (default 301) * - `persist` Passes the params to the redirected route, if it can. This is useful with greedy routes, - * routes that end in `*` are greedy. As you can remap URLs and not loose any passed args. + * routes that end in `*` are greedy. As you can remap URLs and not lose any passed args. * * @param string $route A string describing the template of the route * @param array|string $url A URL to redirect to. Can be a string or a Cake array-based URL @@ -809,7 +809,9 @@ protected function _makeRoute($route, $defaults, $options) */ public function redirect($route, $url, array $options = []) { - $options['routeClass'] = 'Cake\Routing\Route\RedirectRoute'; + if (!isset($options['routeClass'])) { + $options['routeClass'] = 'Cake\Routing\Route\RedirectRoute'; + } if (is_string($url)) { $url = ['redirect' => $url]; }