/** * Creates a new dtb_product */ public function createAction() { if (!$this->request->isPost()) { return $this->dispatcher->forward(array("controller" => "user_product", "action" => "index")); } $dtb_product = new DtbProduct(); $dtb_product->setUserId($this->request->getPost("user_Id")); $dtb_product->setProjectName($this->request->getPost("project_name")); $dtb_product->setProductName($this->request->getPost("product_name")); $dtb_product->setPrice($this->request->getPost("price")); $dtb_product->setProductImg($this->request->getPost("product_img")); $dtb_product->setExistNum($this->request->getPost("exist_num")); if (!$dtb_product->save()) { foreach ($dtb_product->getMessages() as $message) { $this->flash->error($message); } return $this->dispatcher->forward(array("controller" => "user_product", "action" => "new")); } $this->flash->success("dtb_product was created successfully"); return $this->dispatcher->forward(array("controller" => "user_product", "action" => "index")); }