Skip to content
Permalink
Browse files

Make it possible to define a custom routeClass for builder redirects

  • Loading branch information...
Patrick Conroy authored and jeremyharris committed Jan 31, 2017
1 parent 66c8fc3 commit 61343ccb4b783778b3410d1fcb47d2e4eafe6119
Showing with 4 additions and 2 deletions.
  1. +4 −2 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];
}

0 comments on commit 61343cc

Please sign in to comment.
You can’t perform that action at this time.