1

I want to upload image with VichUploaderBundle inside Collection as a required field.

I use use fileType as a new EmbeddedFile() isinde my entity

New form

If I don't provide file, validation tells me to add a file, expected behaviours.

Edit form

If I've ever upload a file and don't provide one, the assertion tells me to add a file (again ?).

Test

I'll try to fix with this trick but:

1/ It doesn't work anymore

2/ I've missed something

I don't provide code because it is as the docs said.

If duplicate please forward me to.

Thanks for your advices.

kl3sk
  • 136
  • 1
  • 11

1 Answers1

-1

Docs say to use a 'required' => false option in your forms.

You can easily switch to a non-required (using true in same option) in form to add a file and keep false in form to edit file.

Massimiliano Arione
  • 2,422
  • 19
  • 40