Having a bit of an issue trying to access some uploaded files in a collection that uses a form type as the elements.
The main form is ProductType which maps the the Product entity and has an unmapped productImagesA field:
$builder->add('productImagesA', CollectionType::class, ['entry_type' => ProductImageType::class,'allow_add' => true,'allow_delete' => true,'required' => false,'mapped' => false,'data'=>[null,null,null,null,null,null],'entry_options' => ['attr' => ['class' => 'custom-file-input', 'accept' => "image/*"] ] ]);
As you can see i'm using a collection of ProductImageType which is mapped to the ProductImage entity which then has a file input and a text input for the image alt tag:
$builder ->add('file', FileType::class, ['required' => false,'mapped'=>false,'label' => 'File Name','attr' => ['class' => 'custom-file-input', 'accept' => "image/*"],'label_attr'=>['class'=>'custom-file-label'],'error_bubbling' => true ])->add('alt',TextType::class,['required'=>false,'mapped'=>false,'label'=>'Alt Text','attr'=>['class'=>'form-control' ],'error_bubbling'=>true ]);
In the controller i grab the collection of productImagesA like this
foreach($form->get('productImagesA')->getData() as $productImage)
The problem is $productImage is an object of ProductImage rather than UploadedFile of course.
So my question here is, how do i actually access the UploadedFile and alt tag inputs from the ProductImageType here? If it wasn't a collection but was just a FileType it would be easy enough with $form->get('someUnmappedFileField')->getData()