when i have error i want to repopulate my form (actually i use the $brand object). even if i use setVar, after the forward, my variable is lost.
public function createAction()
{
$request = $this->request;
if (!$request->isPost()) { return $this->forward("brands/index"); }
$brand = new Brand();
if (!$brand->save($_POST["Brand"], array("name","description","tags"))) {
foreach ($brand->getMessages() as $message) {
$this->flashSession->error((string) $message);
}
$this->view->setVar("brand", $brand);
return $this->dispatcher->forward(array("action" => "new"));
} else {
$this->flash->success("brand was created successfully");
return $this->dispatcher->forward(array("action" => "index"));
}
}
How can i keep my variable ?