php - how to hide an array type of entity in a form in symfony2 -
i have array type in entity want add form type hidden field. tried following doesnt work. kills browser.
any appreciated.
//entity class test{ /** * @orm\column(name="test_image_files", type="array",nullable=true) */ private $testimages; /** * @return mixed */ public function gettestimages() { return $this->testimages; } /** * @param mixed $testimages */ public function settestimages($testimages) { $this->testimages = $testimages; } }
// formtype
class testtype extends abstracttype { public function buildform(formbuilderinterface $builder, array $options) { $builder->add('testimages','hidden'); } }
//twig
{{ form_widget(form.testimages) }}
this handle current situation,
echo form_widget(form.testimages)
inside <div style="display:none"></div>
.
i hope helps.
Comments
Post a Comment