當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Relation::model方法代碼示例

本文整理匯總了PHP中Relation::model方法的典型用法代碼示例。如果您正苦於以下問題:PHP Relation::model方法的具體用法?PHP Relation::model怎麽用?PHP Relation::model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Relation的用法示例。


在下文中一共展示了Relation::model方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getArray

 private function getArray(CDbCriteria $criteria)
 {
     $result = Relation::model()->findAll($criteria);
     $users = array();
     foreach ($result as $value) {
         array_push($users, $value->subUserId);
     }
     return array_values($users);
 }
開發者ID:tiger2soft,項目名稱:travelman,代碼行數:9,代碼來源:RelationComponent.php

示例2: actionDeleteRelation

 public function actionDeleteRelation()
 {
     if (isset($_POST['relation_id'])) {
         $transaction = Yii::app()->db->beginTransaction();
         try {
             $relation = Relation::model()->findByPk($_POST['relation_id']);
             $rdid = $relation->dataset_id;
             $rrdoi = $relation->related_doi;
             $rrid = $relation->relationship_id;
             $relation2 = Relation::model()->findByAttributes(array('dataset_id' => Dataset::model()->findByAttributes(array('identifier' => $rrdoi))->id, 'related_doi' => Dataset::model()->findByPk($rdid)->identifier, 'relationship_id' => $rrid));
             if ($relation->delete() && $relation2->delete()) {
                 $transaction->commit();
                 Util::returnJSON(array("success" => true));
             } else {
                 $transaction->rollback();
                 Util::returnJSON(array("success" => false));
             }
         } catch (Exception $e) {
             $message = $e->getMessage();
             Yii::log(print_r($message, true), 'error');
             $transaction->rollback();
             Util::returnJSON(array("success" => false, "message" => Yii::t("app", "Delete Error.")));
         }
     }
 }
開發者ID:jessesiu,項目名稱:GigaDBV3,代碼行數:25,代碼來源:AdminRelationController.php

示例3: actionRelatedDoiManagement

 public function actionRelatedDoiManagement()
 {
     if (!isset($_GET['id'])) {
         $this->redirect("/user/view_profile");
     } else {
         $dataset = Dataset::model()->findByPk($_GET['id']);
         if (!$dataset) {
             $this->redirect("/user/view_profile");
         }
         if ($dataset->submitter_id != Yii::app()->user->id) {
             Yii::app()->user->setFlash('keyword', "You are not the owner of dataset");
             $this->redirect("/user/view_profile");
         }
         $relations = Relation::model()->findAllByAttributes(array('dataset_id' => $dataset->id), array('order' => 'related_doi asc'));
         $this->render('relatedDoiManagement', array('model' => $dataset, 'relations' => $relations));
     }
 }
開發者ID:jessesiu,項目名稱:GigaDBV3,代碼行數:17,代碼來源:DatasetController.php


注:本文中的Relation::model方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。