Passing values from action class to model class in symfony
- by THOmas
I have a action class for saving some data to a database.In action class iam getting a id through url.I have to save the id in table.
I am getting the id by $request-getParameter('id')
I used this code for saving
$this-form-bind($request-getParameter('question_answers'));
if ($this-form-isValid())
{
$this-form-save();
$this-redirect('@homepage');
}
in model class i used a override save method to save extra field
public function save(Doctrine_Connection $conn = null)
{
if ($this-isNew())
{
$now=date('Y-m-d H:i:s', time());
$this->setPostedAt($now);
}
return parent::save($conn);
so i want to get the id value here .
So how can i pass id value from action class to model class
is any-other way to save the id in action class itself
Thanks in advance