Skip to content

Commit cccefd9

Browse files
committed
Deprecate RouteRedirectView and RedirectView
1 parent 34b5565 commit cccefd9

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

UPGRADING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Upgrading
44
Note as FOSRestBundle is not yet declared stable, this document will be updated to
55
list important BC breaks.
66

7+
### upgrading to 2.0.0 (unreleased)
8+
9+
* RedirectView and RouteRedirect view were removed. Use View::createRedirect and
10+
View::createRouteRedirect instead. Note: the default status code for a route redirect
11+
has changed from HTTP_CREATED (201) to HTTP_FOUND (302).
12+
713
### upgrading from 0.13.1
814

915
* ExceptionController::showAction() doesn't have type hint on the $exception object anymore due to a BC change

View/RedirectView.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ class RedirectView
2727
* @param string $url
2828
* @param integer $statusCode
2929
* @param array $headers
30+
*
31+
* @deprecated To be removed in FOSRestBundle 2.0.0. Use View::createRedirect instead.
3032
*/
3133
public static function create($url, $statusCode = Codes::HTTP_FOUND, array $headers = array())
3234
{
33-
return View::create(null, $statusCode, $headers)->setLocation($url);
35+
return View::createRedirect($url, $statusCode, $headers);
3436
}
3537
}

View/RouteRedirectView.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ class RouteRedirectView
2828
* @param mixed $parameters
2929
* @param integer $statusCode
3030
* @param array $headers
31+
*
32+
* @deprecated To be removed in FOSRestBundle 2.0.0. Use View::createRouteRedirect instead.
3133
*/
3234
public static function create($route, array $parameters = array(), $statusCode = Codes::HTTP_CREATED, array $headers = array())
3335
{
34-
return View::create(null, $statusCode, $headers)->setRoute($route)->setRouteParameters($parameters);
36+
return View::createRouteRedirect($route, $parameters, $statusCode, $headers);
3537
}
3638
}

0 commit comments

Comments
 (0)