public function executeCreate(sfWebRequest $request) { $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isXmlHttpRequest()); $this->checkProject($request); $this->checkProfile($request, $this->ei_project); //Récupération du profil if ($request->isXmlHttpRequest()) { if ($request->getParameter('ei_scenario_id') == null || $request->getParameter('id_version') == null || $request->getParameter('kal_fonction') == null) { $this->forward404Unless('Error . Missing parameters...'); } else { $fonct = new EiFonction(); $fonct->id_version = $request->getParameter('id_version'); $fonct->ei_scenario_id = $request->getParameter('ei_scenario_id'); $fonct->project_id = $this->project_id; $fonct->project_ref = $this->project_ref; $fonct->kal_fonction = $request->getParameter('kal_fonction'); if ($request->getParameter('observation') != null) { $fonct->observation = $request->getParameter('observation'); } $fonct->save(); } return sfView::NONE; } else { $this->form = new EiFonctionForm(); $this->processForm($request, $this->form); $this->setTemplate('new'); } }
public function createCopie($ei_version_str, $conn = null) { $copie = null; try { //$conn->beginTransaction(); //Création de la copie $copie = new EiFonction(); $copie->setDescription($this->getDescription()); $copie->setEiVersionStructure($ei_version_str); $copie->setFunctionId($this->getFunctionId()); $copie->setFunctionRef($this->getFunctionRef()); $copie->setProjectRef($this->getProjectRef()); $copie->setProjectId($this->getProjectId()); //Sauvegarde de la copie $copie->save($conn, false); $params = $this->getEiParams(); if ($params->getFirst()) { foreach ($params as $i => $param) { $param->createCopie($copie->getId(), $conn); } } } catch (Exception $e) { throw $e; } return $copie; }