symfony
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 [...]

Share this on:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Add to favorites
  • email
  • MisterWong
  • MySpace
  • Reddit
  • RSS
  • Yahoo! Bookmarks
Read More
Posted on 4th November 2009No Comments
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 [...]

Share this on:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Add to favorites
  • email
  • MisterWong
  • MySpace
  • Reddit
  • RSS
  • Yahoo! Bookmarks
Read More
Posted on 2nd November 20091 Comment