Reputation: 1502
I have a form which sends data from the server, which works just fine in Symfony, but what I don't know, is how can I set some fields by myself, like the user_id
field, which I clearly don't want the user to send, I want to add the value for that just before Doctrine validates it.
Any relevant documentation links would be also greatly appreciated.
Upvotes: 0
Views: 183
Reputation: 11581
Unset your fields in configure method:
class YourForm extends BaseYourForm
{
public function configure()
{
unset($this['user_id']);
}
}
Override save method of Your model:
class Your extends BaseYour
{
public function save(Doctrine_Connection $conn = null)
{
$this->setUserId($whatever);
parent::save($conn);
}
}
Upvotes: 2