Skip to content

Commit fd44e8f

Browse files
committed
Merge 4.1
2 parents ab5fad6 + 2408e64 commit fd44e8f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

core/graphql.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,6 +2942,29 @@ final class CreateMediaObjectResolver implements MutationResolverInterface
29422942

29432943
For handling the upload of multiple files, iterate over `$context['args']['input']['files']`.
29442944

2945+
### Normalization of MediaObjects
2946+
2947+
In the constructor of the `MediaObjectNormalizer`, the injected Normalizer must be replaced with the one from the
2948+
`api_platform.graphql.normalizer.item` from GraphQL:
2949+
2950+
```php
2951+
<?php
2952+
// api/src/Serializer/MediaObjectNormalizer.php
2953+
2954+
use App\Storage\StorageInterface;
2955+
use ApiPlatform\GraphQl\Serializer\ItemNormalizer;
2956+
2957+
final readonly class MediaObjectNormalizer
2958+
{
2959+
public function __construct(
2960+
#[Autowire(service: ItemNormalizer::class)]
2961+
private NormalizerInterface $normalizer,
2962+
private StorageInterface $storage
2963+
) {}
2964+
2965+
// ...
2966+
}
2967+
29452968
### Using the `createMediaObject` Mutation
29462969

29472970
Following the specification, the upload must be done with a `multipart/form-data` content type.

0 commit comments

Comments
 (0)