当前位置: 首页>>代码示例>>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;未经允许,请勿转载。