Exemplo n.º 1
0
 public function bind(array $taintedValues = null, array $taintedFiles = null)
 {
     $new_occurrences = new BaseForm();
     if (isset($taintedValues['kalParams'])) {
         foreach ($taintedValues['kalParams'] as $key => $new_occurrence) {
             $kalparam = new EiFunctionHasParam();
             $kalparam->setKalFunction($this->getObject());
             $occurrence_form = new EiFunctionHasParamForm($kalparam);
             $new_occurrences->embedForm($key, $occurrence_form);
         }
         $this->embedForm('kalParams', $new_occurrences);
     }
     parent::bind($taintedValues, $taintedFiles);
 }
 public function configure()
 {
     if (!($kalfunction = $this->getOption('kalfunction'))) {
         throw new InvalidArgumentException('You must provide a function object.');
     }
     if (!($param_type = $this->getOption('param_type'))) {
         throw new InvalidArgumentException('You must provide a Type for parameter.');
     }
     for ($i = 0; $i <= $this->getOption('size'); $i++) {
         $kalparam = new EiFunctionHasParam();
         $kalparam->setKalFunction($kalfunction);
         $kalparam->setParamType($param_type);
         $form = new EiFunctionHasParamForm($kalparam);
         $this->embedForm($i, $form);
     }
 }
 public function createNewEiParams(EiFunctionHasParam $p, Doctrine_Connection $conn)
 {
     if ($p == null || $conn == null) {
         return null;
     }
     if ($p->getFunctionId() == null || $p->getFunctionRef() == null) {
         return null;
     }
     $ei_functions = Doctrine_Core::getTable('EiFonction')->findByFunctionIdAndFunctionRef($p->getFunctionId(), $p->getFunctionRef());
     //Si on trouve des fonctions utilisant le nouveau paramètre, alors on crée les paramètres asscociés sur kalifast
     if ($ei_functions->getFirst()) {
         foreach ($ei_functions as $ei_function) {
             $ei_param = new EiParam();
             $ei_param->setIdFonction($ei_function->getId());
             $ei_param->setParamId($p->getParamId());
             $ei_param->setValeur($p->getDefaultValue());
             $ei_param->save($conn);
         }
     }
 }
Exemplo n.º 4
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $this->html = $request->getParameter($form->getName());
         //Si les données sont valides, on envoi en format json la fonction et ses éventuels paramètres pour insertion.
         $this->param_id = EiFunctionHasParam::createOrUpdateDistantParams($this->ei_project, $this->ei_profile, $this->kal_function, json_encode($this->html));
         $this->success = true;
     } else {
         $this->success = false;
     }
 }