You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class ExceptionWrapperHandler implements ExceptionWrapperHandlerInterface
55
+
{
56
+
public function wrap($data)
57
+
{
58
+
return new ExceptionWrapper(array('status_code' => 'foo'));
59
+
}
60
+
}
61
+
```
62
+
63
+
After (if you use the Symfony serializer):
64
+
```yml
65
+
# services.yml
66
+
67
+
services:
68
+
app_bundle.exception_normalizer:
69
+
class: AppBundle\Normalizer\ExceptionNormalizer
70
+
tags:
71
+
- { name: serializer.normalizer }
72
+
```
73
+
```php
74
+
namespace AppBundle\Normalizer;
75
+
76
+
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
77
+
78
+
class ExceptionNormalizer implements NormalizerInterface
79
+
{
80
+
public function normalize($object, $format = null, array $context = array())
81
+
{
82
+
return array('status_code' => 'foo');
83
+
}
84
+
85
+
public function supportsNormalization($data, $format = null)
86
+
{
87
+
return $data instanceof \My\Exception;
88
+
}
89
+
}
90
+
```
42
91
43
92
* removed all ``.class`` parameters, instead overwriting services via explicit Bundle configuration is preferred
44
93
45
94
* renamed ``AbstractScalarParam::$array`` to ``AbstractScalarParam::$map``
46
95
96
+
Before:
97
+
```php
98
+
namespace AppBundle\Controller;
99
+
100
+
class MyController
101
+
{
102
+
/**
103
+
* @RequestParam(name="foo", array=true)
104
+
*/
105
+
public function myAction()
106
+
{
107
+
// ...
108
+
}
109
+
}
110
+
```
111
+
112
+
After:
113
+
```php
114
+
namespace AppBundle\Controller;
115
+
116
+
class MyController
117
+
{
118
+
/**
119
+
* @RequestParam(name="foo", map=true)
120
+
*/
121
+
public function myAction()
122
+
{
123
+
// ...
124
+
}
125
+
}
126
+
```
127
+
47
128
* added `ControllerTrait` for developers that prefer to use DI for their controllers instead of extending ``FOSRestController``
48
129
49
130
* when having an action called ``lockUserAction``, then it will have to use the http method ``LOCK`` (RFC-2518) instead of ``PATCH``. The following methods are affected by this change
@@ -57,10 +138,72 @@ Upgrading From 1.x To 2.0
57
138
58
139
* removed the ability of the ``AccessDeniedListener`` to render a response. Use the FOSRestBundle or the twig exception controller in complement.
59
140
141
+
Before:
142
+
```yml
143
+
# config.yml
144
+
145
+
fos_rest:
146
+
access_denied_listener: true
147
+
```
148
+
149
+
After:
150
+
```yml
151
+
# config.yml
152
+
153
+
fos_rest:
154
+
access_denied_listener: true
155
+
exception: true # Activates the FOSRestBundle exception controller
156
+
```
157
+
60
158
* changed the priority of ``RequestBodyParamConverter`` to ``-50``
61
159
62
160
* made silent the ``RequestBodyParamConverter`` when a parameter is optional and it can't resolve it
63
161
64
162
* removed the ``format_negotiator`` option ``exception_fallback_format``; you can match the ``ExceptionController`` thanks to the ``attributes`` option instead
* `View::setSerializationContext` and `View::getSerializationContext` have been removed. Use `View::setContext` and `View::getContext` together with the new Context class instead.
0 commit comments