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


PHP ActiveQuery::one方法代碼示例

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


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

示例1: getActiveToken

 public static function getActiveToken($token)
 {
     $activeQuery = new ActiveQuery(self::className());
     $activeQuery->where('access_token = :token', [':token' => $token]);
     $activeQuery->andWhere('expires > now()');
     $token = $activeQuery->one();
     return $token;
 }
開發者ID:portalsway2,項目名稱:APEDevices,代碼行數:8,代碼來源:OauthAccessTokens.php

示例2: one

 /**
  * @inheritdoc
  */
 public function one($db = null)
 {
     $row = parent::one($db);
     if ($row !== null && $this->isMappableQuery()) {
         /** @var ActiveRecord|ActiveRecordTrait $className */
         $className = $this->modelClass;
         $className::addRowToMap($row);
     }
     return $row;
 }
開發者ID:yiister,項目名稱:yii2-mappable-ar,代碼行數:13,代碼來源:ActiveQuery.php

示例3: one

 /**
  * @inheritdoc
  * @return Country|array|null
  */
 public function one($db = null)
 {
     $memKey = 'mofei';
     $result = Yii::$app->cache->get($memKey);
     if ($this->isCache && !empty($result)) {
         return $result;
     } else {
         $result = parent::one($db);
         if (!empty($result)) {
             Yii::$app->cache->set($memKey, $result, 5);
         }
         return $result;
     }
 }
開發者ID:study-code,項目名稱:yii2,代碼行數:18,代碼來源:AddressQuery.php

示例4: setupCriteria

 public function setupCriteria()
 {
     $this->activeQuery->joinWith('content');
     $this->activeQuery->joinWith('content.user');
     $this->activeQuery->joinWith('content.space');
     $this->activeQuery->limit($this->limit);
     $this->activeQuery->andWhere(['user.status' => User::STATUS_ENABLED]);
     $this->activeQuery->one();
     /**
      * Handle Stream Mode (Normal Stream or Activity Stream)
      */
     if ($this->mode == self::MODE_ACTIVITY) {
         $this->activeQuery->andWhere(['content.object_model' => \humhub\modules\activity\models\Activity::className()]);
         // Dont show own activities
         if ($this->user != null) {
             $this->activeQuery->leftJoin('activity', 'content.object_id=activity.id AND content.object_model=:activityModel', ['activityModel' => \humhub\modules\activity\models\Activity::className()]);
             $this->activeQuery->andWhere('content.user_id != :userId', array(':userId' => $this->user->id));
         }
     } else {
         $this->activeQuery->andWhere(['!=', 'content.object_model', \humhub\modules\activity\models\Activity::className()]);
     }
     /**
      * Setup Sorting
      */
     if ($this->sort == self::SORT_UPDATED_AT) {
         $this->activeQuery->orderBy('wall_entry.updated_at DESC');
         if ($this->from != "") {
             $this->activeQuery->andWhere("wall_entry.updated_at < (SELECT updated_at FROM wall_entry wd WHERE wd.id=" . $this->from . ")");
         }
     } else {
         $this->activeQuery->orderBy('wall_entry.id DESC');
         if ($this->from != "") {
             $this->activeQuery->andWhere("wall_entry.id < " . $this->from);
         }
     }
 }
開發者ID:alefernie,項目名稱:intranet,代碼行數:36,代碼來源:Stream.php

示例5: one

 /**
  * @inheritdoc
  * @return Progressjobdetail|array|null
  */
 public function one($db = null)
 {
     return parent::one($db);
 }
開發者ID:adem-team,項目名稱:advancedgsn,代碼行數:8,代碼來源:ProgressjobdetailQuery.php

示例6: one

 /**
  * @param Connection $db
  * @return ActiveRecord|null
  */
 public function one($db = null)
 {
     $row = parent::one($db);
     return $row;
 }
開發者ID:nfilin,項目名稱:yii2-libs,代碼行數:9,代碼來源:ActiveQuery.php

示例7: findOne

 /**
  * @return static|null ActiveRecord instance matching the condition, or `null` if nothing matches.
  */
 public function findOne()
 {
     return $this->query->one();
 }
開發者ID:pbabilas,項目名稱:bcode,代碼行數:7,代碼來源:Searcher.php


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