api-platform / api-platform/core
Set Serialization Groups Manually [feature]
- Vorherrschende Sprache
- PHP
- Sterne
- 2.6k
- Forks
- 980
- Ø Merge
- 2 T. 5 Std.
- Gemergte PRs (30 T.)
- 48
Beschreibung
**Description**
Make it possible to define the serialization group through the request attributes.
Something like this:
**Example**
https://github.com/api-platform/core/blob/22ce6399180f9408f19b0b3c857317d2ddd7ea9d/src/Serializer/SerializerContextBuilder.php#L60
```php
$context = $resourceMetadata->getTypedOperationAttribute($operationType, $attributes[$operationKey], $key, [], true);
if ($context and $context['groups']) {
$serializerContext = $request->attributes->get('_api_serializer_context', []);
$context = array_merge_recursive($context, $serializerContext);
}
```
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.