php - Symfony - set form value on save -


A quick question I have a symphony form when I save the form, I want to save my built-in field Automatically set up

So, I am passing the current user ID as an option in this form:

  $ this-> Form = new contract form (empty, array ("created_b" => gtc; $ this-> getUser () - & gt; getId ());  

And in the form class I have configured:

  $ this-> Set default ('created_by', $ this- & gt; getOption ("created by"));  

If I had a widget created and it was hidden, it would do a great job, however, I do not want to display a field because the user can easily firebug or other device one like.

So my question is, if the field does not exist as a widget, how can I save the column value?

You do not need a widget for this, in the configured form of your form call.

  & lt ;? Php $ this- & gt; GetObject () - & gt; SetCreatedBy ($ this-> getOption ('created_by')); ? & Gt;  

There really is no need to overwrite a method.

You need to start your form to work for it

  & lt ;? Php $ this- & gt; Form = new contract form (new contract), array ('created_by' => gt = $ -> getUser () - & gt; getId ()); `? & Gt;  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -