plugins - Symfony getUser and save to form -


i have symfony form few hidden fields user can't edit set automatically when submit form. 1 field can't seem set userid. form secured requires authentication in order display (sfdoctrineguardplugin).

what i'm looking form set "user_id" field logged in username. have tried in class file.

 if ($this->isnew() && ! $this->getseller_id()) { $this->setseller_id($this->getuser()->getguarduser()->getusername()); } 

but returns error stating there no user field in current table. hope explained right.

do not set user_id in hidden field. change via firebug. preffer use code inside proccessform()

try (edited):

 $form = new yourform(); $this->user = $this->getuser()->getobject(); $form->getobject()->setsellerid($this->user->getid()); $form->bind($request->getparameter($form->getname())); 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -