Skip to content

Commit

Permalink
Make it possible to define a custom routeClass for builder redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Conroy authored and jeremyharris committed Sep 21, 2017
1 parent 66c8fc3 commit 61343cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Routing/RouteBuilder.php
Expand Up @@ -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
Expand All @@ -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];
}
Expand Down

0 comments on commit 61343cc

Please sign in to comment.