当前位置: 首页>>代码示例>>PHP>>正文


PHP Doctrine_Collection::getFirst方法代码示例

本文整理汇总了PHP中Doctrine_Collection::getFirst方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Collection::getFirst方法的具体用法?PHP Doctrine_Collection::getFirst怎么用?PHP Doctrine_Collection::getFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine_Collection的用法示例。


在下文中一共展示了Doctrine_Collection::getFirst方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reload

 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;
     }
 }
开发者ID:lendji4000,项目名称:compose,代码行数:32,代码来源:EiProjectLangTable.class.php

示例2: reload

 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;
     }
 }
开发者ID:lendji4000,项目名称:compose,代码行数:55,代码来源:EiVersionNoticeTable.class.php

示例3: reload

 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
     }
 }
开发者ID:lendji4000,项目名称:compose,代码行数:47,代码来源:EiViewTable.class.php

示例4: reload

 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;
     }
 }
开发者ID:lendji4000,项目名称:compose,代码行数:45,代码来源:EiNoticeTable.class.php

示例5: reload

 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;
     }
 }
开发者ID:lendji4000,项目名称:compose,代码行数:47,代码来源:KalFunctionTable.class.php

示例6: createRelationForProfileChild

 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
     }
 }
开发者ID:lendji4000,项目名称:compose,代码行数:23,代码来源:EiProfilTable.class.php


注:本文中的Doctrine_Collection::getFirst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。