api-platform / api-platform/core
Set Serialization Groups Manually [feature]
- Dominant language
- PHP
- Stars
- 2.6k
- Forks
- 980
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 48
Description
**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);
}
```
Contributor guide
Assessment
This issue has not been assessed yet.