api-platform / api-platform/core
Set Serialization Groups Manually [feature]
未关闭
- 主要语言
- PHP
- 星标
- 2.6k
- 派生
- 980
- 平均合并
- 2 天 5 小时
- 30 天内合并 PR
- 48
描述
**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);
}
```
贡献指南
评估
这个 Issue 还没有评估数据。