I
I
Ivan Antonov2015-10-20 12:42:24
symfony
Ivan Antonov, 2015-10-20 12:42:24

How to replace the entity photo?

When I add a company, I need to upload its logo:
I upload it like this:
AddCompanyType:

$builder->add('image', new FileType(), array('label' => 'Логотип'));

filetype:
$builder->add('file', 'file', array('label' => false));

The download is working fine. But I can't figure out how to edit a picture when I edit a company.
We need the same form, with a clean logo upload field. When saving - if the logo field is empty, then the logo is not updated; if a new logo is given, then update it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Skobkin, 2015-10-20
@antonowano

Well, in the controller, you can describe the logic for updating the entity, and not just automatically fill it with new data from the form.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question