@@ -24,6 +24,44 @@ DoctrineBridge
24
24
--------------
25
25
26
26
* Deprecate passing Doctrine subscribers to ` ContainerAwareEventManager ` class, use listeners instead
27
+
28
+ * Before*
29
+ ``` php
30
+ use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
31
+ use Doctrine\ORM\Event\PostFlushEventArgs;
32
+ use Doctrine\ORM\Events;
33
+
34
+ class InvalidateCacheSubscriber implements EventSubscriberInterface
35
+ {
36
+ public function getSubscribedEvents(): array
37
+ {
38
+ return [Events::postFlush];
39
+ }
40
+<
8000
/span>
41
+ public function postFlush(PostFlushEventArgs $args): void
42
+ {
43
+ // ...
44
+ }
45
+ }
46
+ ```
47
+
48
+ * After*
49
+ ``` php
50
+ use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener;
51
+ use Doctrine\ORM\Event\PostFlushEventArgs;
52
+ use Doctrine\ORM\Events;
53
+
54
+ // Instead of PHP attributes, you can also tag this service with "doctrine.event_listener"
55
+ #[AsDoctrineListener(event: Events::postFlush)]
56
+ class InvalidateCacheSubscriber
57
+ {
58
+ public function postFlush(PostFlushEventArgs $args): void
59
+ {
60
+ // ...
61
+ }
62
+ }
63
+ ```
64
+
27
65
* Deprecate ` DoctrineDbalCacheAdapterSchemaSubscriber ` in favor of ` DoctrineDbalCacheAdapterSchemaListener `
28
66
* Deprecate ` MessengerTransportDoctrineSchemaSubscriber ` in favor of ` MessengerTransportDoctrineSchemaListener `
29
67
* Deprecate ` RememberMeTokenProviderDoctrineSchemaSubscriber ` in favor of ` RememberMeTokenProviderDoctrineSchemaListener `
@@ -65,10 +103,6 @@ FrameworkBundle
65
103
/>
66
104
</framework : config >
67
105
```
68
-
69
- FrameworkBundle
70
- ---------------
71
-
72
106
* Deprecate the ` notifier.logger_notification_listener ` service, use the ` notifier.notification_logger_listener ` service instead
73
107
* Deprecate the ` Http\Client\HttpClient ` service, use ` Psr\Http\Client\ClientInterface ` instead
74
108
@@ -126,19 +160,57 @@ Security
126
160
SecurityBundle
127
161
--------------
128
162
129
- * Deprecate enabling bundle and not configuring it
163
+ * Deprecate enabling bundle and not configuring it, either remove the bundle or configure at least one firewall
130
164
* Deprecate the ` security.firewalls.logout.csrf_token_generator ` config option, use ` security.firewalls.logout.csrf_token_manager ` instead
131
165
132
- Validator
133
- ---------
134
-
135
- * Implementing the ` ConstraintViolationInterface ` without implementing the ` getConstraint() ` method is deprecated
136
-
137
166
Serializer
138
167
----------
139
168
140
169
* Deprecate ` CacheableSupportsMethodInterface ` in favor of the new ` getSupportedTypes(?string $format) ` methods
141
- * The following Normalizer classes will become final in 7.0:
170
+
171
+ * Before*
172
+ ``` php
173
+ use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
174
+ use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
175
+
176
+ class TopicNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface
177
+ {
178
+ public function supportsNormalization($data, string $format = null, array $context = []): bool
179
+ {
180
+ return $data instanceof Topic;
181
+ }
182
+
183
+ public function hasCacheableSupportsMethod(): bool
184
+ {
185
+ return true;
186
+ }
187
+
188
+ // ...
189
+ }
190
+ ```
191
+
192
+ * After*
193
+ ``` php
194
+ use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
195
+
196
+ class TopicNormalizer implements NormalizerInterface
197
+ {
198
+ public function supportsNormalization($data, string $format = null, array $context = []): bool
199
+ {
200
+ return $data instanceof Topic;
201
+ }
202
+
<
A935
/td>203
+ public function getSupportedTypes(?string $format): array
204
+ {
205
+ return [
206
+ Topic::class => true,
207
+ ];
208
+ }
209
+
210
+ // ...
211
+ }
212
+ ```
213
+ * The following Normalizer classes will become final in 7.0, use decoration instead of inheritance:
142
214
* ` ConstraintViolationListNormalizer `
143
215
* ` CustomNormalizer `
144
216
* ` DataUriNormalizer `
@@ -149,3 +221,49 @@ Serializer
149
221
* ` JsonSerializableNormalizer `
150
222
* ` ObjectNormalizer `
151
223
* ` PropertyNormalizer `
224
+
225
+ * Before*
226
+ ``` php
227
+ use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
228
+
229
+ class TopicNormalizer extends ObjectNormalizer
230
+ {
231
+ // ...
232
+
233
+ public function normalize($topic, string $format = null, array $context = []): array
234
+ {
235
+ $data = parent::normalize($topic, $format, $context);
236
+
237
+ // ...
238
+ }
239
+ }
240
+ ```
241
+
242
+ * After*
243
+ ``` php
244
+ use Symfony\Component\DependencyInjection\Attribute\Autowire;
245
+ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
246
+ use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
247
+
248
+ class TopicNormalizer implements NormalizerInterface
249
+ {
250
+ public function __construct(
251
+ #[Autowire(service: 'serializer.normalizer.object')] private NormalizerInterface&DenormalizerInterface $objectNormalizer,
252
+ ) {
253
+ }
254
+
255
+ public function normalize($topic, string $format = null, array $context = []): array
256
+ {
257
+ $data = $this->objectNormalizer->normalize($topic, $format, $context);
258
+
259
+ // ...
260
+ }
261
+
262
+ // ...
263
+ }
264
+ ```
265
+
266
+ Validator
267
+ ---------
268
+
269
+ * Implementing the ` ConstraintViolationInterface ` without implementing the ` getConstraint() ` method is deprecated
0 commit comments