api-platform / api-platform/core

Set Serialization Groups Manually [feature]

オープン
#8,004 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
PHP
スター
2.6k
フォーク
980
平均マージ
2日 5時間
マージ済み PR(30日)
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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。