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 EiProjectLang à ajouter $collection = new Doctrine_Collection("EiProjectLang"); $items = $projets->getElementsByTagName("ei_project_langs"); if ($items->length > 0) { //ya t-il des éléments à traiter? $ei_project_langs = $items->item(0)->getElementsByTagName("ei_project_lang"); if ($ei_project_langs->length > 0) { foreach ($ei_project_langs as $ei_project_lang) { $lang_id = $ei_project_lang->getAttribute("lang"); //recherche du profil en base if ($lang_id != null && $project_ref != null && $project_id != null) { $new_ei_project_lang = new EiProjectLang(); $new_ei_project_lang->setLang($lang_id); $new_ei_project_lang->setProjectId($project_id); $new_ei_project_lang->setProjectRef($project_ref); $collection->add($new_ei_project_lang); } } if ($collection->getFirst()) { $collection->save($conn); } //Sauvegarde de la collection return 1; } return null; } }
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 EiVersionNotice à ajouter $collection = new Doctrine_Collection("EiVersionNotice"); //Supression des versions de notice qui n'existent plus sur script $this->deleteNotFoundVersionNotice($conn); $items = $projets->getElementsByTagName("ei_version_notices"); if ($items->length > 0) { //ya t-il des éléments à traiter? $ei_version_notices = $items->item(0)->getElementsByTagName("ei_version_notice"); if ($ei_version_notices->length > 0) { foreach ($ei_version_notices as $ei_version_notice) { $notice_id = $ei_version_notice->getAttribute("notice_id"); $notice_ref = $ei_version_notice->getAttribute("notice_ref"); $version_notice_id = $ei_version_notice->getAttribute("version_notice_id"); $lang = $ei_version_notice->getAttribute("lang"); //recherche du profil en base if ($notice_id != null && $notice_ref != null && $version_notice_id != null && $lang != null) { $q = Doctrine_Core::getTable('EiVersionNotice')->findOneByNoticeIdAndNoticeRefAndVersionNoticeIdAndLang($notice_id, $notice_ref, $version_notice_id, $lang); if ($q && $q != null) { //si l'element existe , on fait une mise à jour $q->setName($ei_version_notice->getElementsByTagName("name")->item(0)->nodeValue); $q->setDescription($ei_version_notice->getElementsByTagName("description")->item(0)->nodeValue); $q->setExpected($ei_version_notice->getElementsByTagName("expected")->item(0)->nodeValue); $q->setResult($ei_version_notice->getElementsByTagName("result")->item(0)->nodeValue); $q->setIsActive($ei_version_notice->getElementsByTagName("is_active")->item(0)->nodeValue); $q->save($conn); } else { //l'élément n'existe pas encore, et dans ce cas on le crée $new_ei_version_notice = new EiVersionNotice(); $new_ei_version_notice->setNoticeId($notice_id); $new_ei_version_notice->setNoticeRef($notice_ref); $new_ei_version_notice->setVersionNoticeId($version_notice_id); $new_ei_version_notice->setLang($lang); $new_ei_version_notice->setDescription($ei_version_notice->getElementsByTagName("description")->item(0)->nodeValue); $new_ei_version_notice->setExpected($ei_version_notice->getElementsByTagName("expected")->item(0)->nodeValue); $new_ei_version_notice->setResult($ei_version_notice->getElementsByTagName("result")->item(0)->nodeValue); $new_ei_version_notice->setName($ei_version_notice->getElementsByTagName("name")->item(0)->nodeValue); $new_ei_version_notice->setIsActive($ei_version_notice->getElementsByTagName("is_active")->item(0)->nodeValue); $collection->add($new_ei_version_notice); } } } if ($collection->getFirst()) { $collection->save($conn); } //Sauvegarde de la collection return 1; } return null; } }
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 View à ajouter $collection = new Doctrine_Collection("EiView"); $items = $projets->getElementsByTagName("ei_views"); if ($items->length > 0) { //ya t-il des éléments à traiter? $ei_views = $items->item(0)->getElementsByTagName("ei_view"); if ($ei_views->length > 0) { foreach ($ei_views as $ei_view) { $view_id = $ei_view->getAttribute("view_id"); $view_ref = $ei_view->getAttribute("view_ref"); //recherche du profil en base if ($view_id != null && $view_ref != null) { $q = Doctrine_Core::getTable('EiView')->findOneByViewIdAndViewRef($view_id, $view_ref); if ($q && $q != null) { //si l'element existe , on fait une mise à jour $q->setDescription($ei_view->getElementsByTagName("description")->item(0)->nodeValue); $q->setIsActive($ei_view->getElementsByTagName("is_active")->item(0)->nodeValue); $q->save($conn); } else { //l'élément n'existe pas encore, et dans ce cas on le crée $new_ei_view = new EiView(); $new_ei_view->setViewId($view_id); $new_ei_view->setViewRef($view_ref); $new_ei_view->setDescription($ei_view->getElementsByTagName("description")->item(0)->nodeValue); $new_ei_view->setIsActive($ei_view->getElementsByTagName("is_active")->item(0)->nodeValue); $new_ei_view->setProjectId($project_id); $new_ei_view->setProjectRef($project_ref); // $new_ei_view->save($conn); $collection->add($new_ei_view); } } } if ($collection->getFirst()) { $collection->save($conn); } //Sauvegarde de la collection return 1; } return null; //On a retrouvé aucun élément de ce type } }
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 EiNotice à ajouter $collection = new Doctrine_Collection("EiNotice"); //Supréssion des notices n'existant plus $this->deleteNotFoundNotice(); $items = $projets->getElementsByTagName("ei_notices"); if ($items->length > 0) { //ya t-il des éléments à traiter? $ei_notices = $items->item(0)->getElementsByTagName("ei_notice"); if ($ei_notices->length > 0) { foreach ($ei_notices as $ei_notice) { $notice_id = $ei_notice->getAttribute("notice_id"); $notice_ref = $ei_notice->getAttribute("notice_ref"); //recherche du profil en base if ($notice_id != null && $notice_ref != null) { $q = Doctrine_Core::getTable('EiNotice')->findOneByNoticeIdAndNoticeRef($notice_id, $notice_ref); if ($q && $q != null) { //si l'element existe , on fait une mise à jour $q->setName($ei_notice->getElementsByTagName("name")->item(0)->nodeValue); $q->save($conn); } else { //l'élément n'existe pas encore, et dans ce cas on le crée $new_ei_notice = new EiNotice(); $new_ei_notice->setNoticeId($notice_id); $new_ei_notice->setNoticeRef($notice_ref); $new_ei_notice->setFunctionId($ei_notice->getElementsByTagName("function_id")->item(0)->nodeValue); $new_ei_notice->setFunctionRef($ei_notice->getElementsByTagName("function_ref")->item(0)->nodeValue); $new_ei_notice->setName($ei_notice->getElementsByTagName("name")->item(0)->nodeValue); $collection->add($new_ei_notice); } } } if ($collection->getFirst()) { $collection->save($conn); } //Sauvegarde de la collection return 1; } return null; } }
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 KalFunction à ajouter $collection = new Doctrine_Collection("KalFunction"); $items = $projets->getElementsByTagName("ei_functions"); if ($items->length > 0) { //ya t-il des éléments à traiter? $ei_functions = $items->item(0)->getElementsByTagName("ei_function"); if ($ei_functions->length > 0) { foreach ($ei_functions as $ei_function) { $function_id = $ei_function->getAttribute("function_id"); $function_ref = $ei_function->getAttribute("function_ref"); //recherche de la fonction en base if ($function_id != null && $function_ref != null) { $q = Doctrine_Core::getTable('KalFunction')->findOneByFunctionIdAndFunctionRef($function_id, $function_ref); if ($q && $q != null) { //si l'element existe , on fait une mise à jour $q->setDescription($ei_function->getElementsByTagName("description")->item(0)->nodeValue); $q->setIsActive($ei_function->getElementsByTagName("is_active")->item(0)->nodeValue); $q->save($conn); //On supprime toutes les commandes associées à la fonction Doctrine_Core::getTable('EiFunctionHasCommande')->deleteAssociatedCmd($q, $conn); } else { //l'élément n'existe pas encore, et dans ce cas on le crée $new_ei_function = new KalFunction(); $new_ei_function->setFunctionId($function_id); $new_ei_function->setFunctionRef($function_ref); $new_ei_function->setProjectId($project_id); $new_ei_function->setProjectRef($project_ref); $new_ei_function->setDescription($ei_function->getElementsByTagName("description")->item(0)->nodeValue); $new_ei_function->setIsActive($ei_function->getElementsByTagName("is_active")->item(0)->nodeValue); $collection->add($new_ei_function); } } } if ($collection->getFirst()) { $collection->save($conn); } //Sauvegarde de la collection return 1; } return null; } }
public function createRelationForProfileChild(EiProfil $profileParent, EiProfil $profile, Doctrine_Connection $conn = null) { if ($conn == null) { $conn = Doctrine_Manager::connection(); } $collection1 = $conn->getTable('EiProfilScenario')->findByProfileIdAndProfileRef($profileParent->getProfileId(), $profileParent->getProfileRef()); //Si des relations existent alors on les recrée pour le profil enfant if ($collection1->getFirst()) { $collection2 = new Doctrine_Collection('EiProfilScenario'); foreach ($collection1 as $profil_scenario) { $new_obj = new EiProfilScenario(); $new_obj->setProfileId($profile->getProfileId()); $new_obj->setProfileRef($profile->getProfileRef()); $new_obj->setEiScenarioId($profil_scenario->getEiScenarioId()); $new_obj->setEiVersionId($profil_scenario->getEiVersionId()); $collection2->add($new_obj); } if ($collection2->getFirst()) { $collection2->save($conn); } //Sauvegarde des nouvelles relations } }