api-platform / api-platform/core

Set Serialization Groups Manually [feature]

Offen
#8,004 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
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

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.