public function reload($projets, $project_id, $project_ref, Doctrine_Connection $conn = null) { if ($conn == null) { $conn = Doctrine_Manager::connection(); } //Création de la collection d'objet EiFunctionHasParam à ajouter $collection = new Doctrine_Collection("EiFunctionHasParam"); Doctrine_Core::getTable('ScriptEiFunctionHasParam')->emptyTmpTable($conn); $list_id = array(); $items = $projets->getElementsByTagName("ei_function_has_params"); if ($items->length > 0) { //ya t-il des éléments à traiter? $ei_function_has_params = $items->item(0)->getElementsByTagName("ei_function_has_param"); //Enregistrement de tous les paramètres à rajouter dans la table temporaire Doctrine_Core::getTable('ScriptEiFunctionHasParam')->insertTmpData($ei_function_has_params, $conn); if ($ei_function_has_params != null) { foreach ($ei_function_has_params as $ei_function_has_param) { $param_id = $ei_function_has_param->getAttribute("param_id"); $list_id[] = $param_id; //recherche du paramètre en base if ($param_id != null) { $q = Doctrine_Core::getTable('EiFunctionHasParam')->findOneByParamId($param_id); if ($q && $q != null) { //si l'element existe , on fait une mise à jour $q->setParamType($ei_function_has_param->getElementsByTagName("param_type")->item(0)->nodeValue); $q->setName($ei_function_has_param->getElementsByTagName("name")->item(0)->nodeValue); $q->setDescription($ei_function_has_param->getElementsByTagName("description")->item(0)->nodeValue); $q->setDefaultValue($ei_function_has_param->getElementsByTagName("default_value")->item(0)->nodeValue); $q->setIsCompulsory($ei_function_has_param->getElementsByTagName("is_compulsory")->item(0)->nodeValue); $q->save($conn); } else { //l'élément n'existe pas encore, on le crée $new_ei_function_has_param = new EiFunctionHasParam(); $new_ei_function_has_param->setParamId($param_id); $new_ei_function_has_param->setFunctionId($ei_function_has_param->getElementsByTagName("function_id")->item(0)->nodeValue); $new_ei_function_has_param->setFunctionRef($ei_function_has_param->getElementsByTagName("function_ref")->item(0)->nodeValue); $new_ei_function_has_param->setParamType($ei_function_has_param->getElementsByTagName("param_type")->item(0)->nodeValue); $new_ei_function_has_param->setName($ei_function_has_param->getElementsByTagName("name")->item(0)->nodeValue); $new_ei_function_has_param->setDescription($ei_function_has_param->getElementsByTagName("description")->item(0)->nodeValue); $new_ei_function_has_param->setDefaultValue($ei_function_has_param->getElementsByTagName("default_value")->item(0)->nodeValue); $new_ei_function_has_param->setIsCompulsory($ei_function_has_param->getElementsByTagName("is_compulsory")->item(0)->nodeValue); $new_ei_function_has_param->save($conn); //On crée les paramètres associés à ce derniers pour les fonctions concernées //Avant on vérifie que le paramètre en question est un paramètre d'entrée . if ($new_ei_function_has_param->getParamType() == 'IN') { $this->createNewEiParams($new_ei_function_has_param, $conn); } } } } //Suppression des paramètres n'existants plus du coté de script $this->deleteNotFoundParams($conn); return $list_id; } return $list_id; } //Suppression des paramètres n'existants plus du coté de script $this->deleteNotFoundParams($conn); return $list_id; }
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); } }