Passing values from action class to model class in symfony

Posted by THOmas on Stack Overflow See other posts from Stack Overflow or by THOmas
Published on 2010-03-17T10:50:41Z Indexed on 2010/03/17 12:11 UTC
Read the original article Hit count: 231

Filed under:

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

© Stack Overflow or respective owner

Related posts about symfony