Skip to content

Commit

Permalink
Deprecate some of the static methods in Router.
Browse files Browse the repository at this point in the history
All of these methods have nicer/better cousins on RouteBuilder. By
deprecating these methods we can remove them for 4.x. This is a possibly
a contentious change as I suspect a few people are using these methods.
  • Loading branch information
markstory committed Mar 25, 2016
1 parent e400bc1 commit f288e4c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Routing/Router.php
Expand Up @@ -219,9 +219,14 @@ public static function connect($route, $defaults = [], $options = [])
* shifted into the passed arguments. As well as supplying patterns for routing parameters.
* @return void
* @see \Cake\Routing\RouteBuilder::redirect()
* @deprected 3.3.0 Use Router::scope() and RouteBuilder::redirect() instead.
*/
public static function redirect($route, $url, $options = [])
{
trigger_error(
'Router::redirect() is deprecated. Use Router::scope() and $routes->redirect() instead.',
E_USER_DEPRECATED
);
$options['routeClass'] = 'Cake\Routing\Route\RedirectRoute';
if (is_string($url)) {
$url = ['redirect' => $url];
Expand Down Expand Up @@ -279,10 +284,15 @@ public static function redirect($route, $url, $options = [])
* @param string|array $controller A controller name or array of controller names (i.e. "Posts" or "ListItems")
* @param array $options Options to use when generating REST routes
* @see \Cake\Routing\RouteBuilder::resources()
* @deprecated 3.3.0 Use Router::scope() and RouteBuilder::resources() instead.
* @return void
*/
public static function mapResources($controller, $options = [])
{
trigger_error(
'Router::mapResources() is deprecated. Use Router::scope() and $routes->resources() instead.',
E_USER_DEPRECATED
);
foreach ((array)$controller as $name) {
list($plugin, $name) = pluginSplit($name);

Expand Down Expand Up @@ -798,9 +808,14 @@ public static function extensions($extensions = null, $merge = true)
* @param \Cake\Network\Request $request The request object to modify.
* @param array $options The array of options.
* @return \Cake\Network\Request The modified request
* @deprecated 3.3.0 Named parameter backwards compatibility will be removed in 4.0.
*/
public static function parseNamedParams(Request $request, array $options = [])
{
trigger_error(
'Router::parseNamedParams() is deprecated and will be removed in 4.0.',
E_USER_DEPRECATED
);
$options += ['separator' => ':'];
if (empty($request->params['pass'])) {
$request->params['named'] = [];
Expand Down

0 comments on commit f288e4c

Please sign in to comment.