I need to set the value of a symfony2 form element. I use a doctrine2 entity, a Symfony\Component\Form\AbstractType and the createForm() method inside my Controllers Action.
$saleDataForm = $this->createForm(new SaleType(), $sale);
Now, how do i get an element from that form, and how can i set it's value? I want to do something like this, but it doesn't work:
$saleDataForm->get('image')->setValue('someimapge.jpg');
FYI: I need to do this to render the field correctly (using this approach, my image field is always empty and i need to set it to the content of imagePath to present a preview of an uploaded image)