J'ai une entité Product incorporant une collection de mediaObjects

class Product
{
....

    #[ORM\OneToMany(mappedBy: 'product', targetEntity: MediaObject::class, cascade: ['persist', 'remove'])]
    #[Groups(['read:product', 'write:product'])]
    #[ApiProperty(
        openapiContext: [
            'type' => 'array',
            'items' => [
                'type' => 'string',
                'format' => 'binary',
            ],
        ]
    )]
    private $gallery;

    ....
}
#[ApiResource(
    collectionOperations: ['get',
        'post' => [
            'input_formats' => [
                'multipart' => ['multipart/form-data'],
            ],
        ],
    ]
    )
 ]
/** @Vich\Uploadable */
class MediaObject
{
...

#[Groups(['read:mediaObject'])]
    private ?string $contentUrl;

    /**
     * @Vich\UploadableField(mapping="mediaObjects_mapping", fileNameProperty="filePath")
     */
    #[Groups(['write:mediaObject'])]
    #[Assert\NotNull(groups: ['write:mediaObject', 'write:product'])]
    #[ApiProperty(
        openapiContext: [
            'type' => 'string',
            'format' => 'binary',
        ]
    )]
    private $file;

    #[ORM\Column(type: 'string', length: 255, nullable: true)]
    private ?string $filePath;

...
}

Ce que je veux

existe-t-il un moyen de publier un Product contenant une collection de mediaObjects ?

Ce que j'obtiens

Coté admin (react-admin & api-platform/admin) :

<FileInput source={'gallery'} multiple={true} accept="image/*">
      <ImageField source="src" title="title"/>
</FileInput>

Resultat : insertion des données dans DB mais contenu mediaObject.file_path est null
NB : Uploaded Files est null

Coté Api docs :
Error : The type of the gallery attribute must be array, object given.
NB : Uploaded Files contient gallery de type uploadFile

Coté insomnia :
Request type POST content-type : multipart

...
gallery[] : img1-jpg
gallery[] : img2-jpg
gallery[] : img3-jpg

Resultat : Done
NB : Uploaded Files contient gallery de type array [ items : uploadFile ]

Aucune réponse