Symfony: Allowing extra field in validated forms
A quick hint: it unnerves me when I have to add a new field to a Doctrine form that does not belong to the model and thus always fires a validator error. Since I don’t have time and don’t want to create a whole validator array for my rather big form, I used
$this->validatorSchema->setOption(’allow_extra_fields’, true);
to allow [...]
Symfony: How to get data from session into form
I tried to put the user id from the session into a hidden form field and – guess what? I tried for friggin’ 30 minutes to figure out how.
In standard PHP, you would have put <?php echo $_SESSION['userId'] ?> and be set, but in Symfony, you have to put sfContext::getInstance()->getUser()->getAttribute(’…’); in your action to [...]
