/** * Transform Symfony UploadedFile into AttachmentInput * @param array $value * @return array The array of AttachmentInput transformed from Symfony UploadedFile */ public function reverseTransform($value) { $inputs = array(); foreach ($value as $each) { if ($each) { if (false === $each instanceof UploadedFile) { throw new TransformationFailedException("Every item in input files array should be an instance of the UploadedFile."); } $attachment = AttachmentInput::createFromUploadedFile($each); array_push($inputs, $attachment); } } return $inputs; }