Thanks so much for your reply!

The bind overriding seems like the best solution, that means the extra
values are attached to the form, which an be used in multiple apps.

The only problem is my manually processed value require input from the
form. How do I get that from the bind() method? I could set the extra
variables to be in the array returned by $request->getParameter($form-
>getName()), but then I get an exception because there's values in the
array that don't correlate to a model field.

Any suggestions?

On May 2, 6:26 pm, Erkhembayar Gantulga <erheme...@gmail.com> wrote:
> Hi *OnDistantShores*
>
> You can override Bind method in your Form :
>
> public function bind(array $taintedValues = null, array $taintedFiles =
> null)
>     {
>
>        $taintedValues['your override form field'] = 'blah';
>
>        parent::bind($taintedValues, $taintedFiles);
>     }
>
> and Also, you can change value before save(), just override setter or save
> method in your model.
>
> Good luck!
>
> *Erkhembayar Gantulga*
>
> On Mon, May 2, 2011 at 4:03 PM, OnDistantShores <cameron.r...@gmail.com>wrote:
>
> > I'm still a Symfony newbie. I'm using the "generate-module" call to
> > create a form for my model and that's working fine. However I want to
> > manually override some of the values from the form submission, to
> > process them a bit on the backend before saving them.
>
> > What is the best way to do this? Before $form->bind()? After? How?
>
> > The only way I've found so far to do this is to wait until the
> > $myModel = $form->save() call and then change values on $myModel and
> > save again. But this means two saves, which clearly isn't efficient.
> > I'm sure there's another way to do this...but how?
>
> > Thanks!
>
> > --
> > If you want to report a vulnerability issue on symfony, please send it to
> > security at symfony-project.com
>
> > You received this message because you are subscribed to the Google
> > Groups "symfony users" group.
> > To post to this group, send email to symfony-users@googlegroups.com
> > To unsubscribe from this group, send email to
> > symfony-users+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to