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


PHP ActiveQuery::andFilterWhere方法代碼示例

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


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

示例1: filterAttributes

 /**
  * Фильтрация по атрибутам
  */
 protected function filterAttributes()
 {
     if ($this->_mainQuery) {
         if ($this->hasAttribute('id')) {
             $this->_mainQuery->andFilterWhere(['id' => $this->id]);
         }
         if ($this->hasAttribute('user_id')) {
             $this->_mainQuery->andFilterWhere(['user_id' => $this->user_id]);
         }
         if ($this->hasAttribute('type_key')) {
             $this->_mainQuery->andFilterWhere(['type_key' => $this->type_key]);
         }
         if ($this->hasAttribute('app_id')) {
             $this->_mainQuery->andFilterWhere(['app_id' => $this->app_id]);
         }
         if ($this->hasAttribute('model_name')) {
             $this->_mainQuery->andFilterWhere(['like', 'model_name', $this->model_name]);
         }
         if ($this->hasAttribute('model_name')) {
             $this->_mainQuery->andFilterWhere(['like', 'table_name', $this->table_name]);
         }
         if ($this->hasAttribute('created_at')) {
             $this->_mainQuery->andFilterWhere(['like', 'created_at', $this->created_at]);
         }
     }
 }
開發者ID:nazartsev,項目名稱:yii2-data-log,代碼行數:29,代碼來源:DataLogForm.php

示例2: filterAttributes

 /**
  * For filtering attributes
  */
 protected function filterAttributes()
 {
     if ($this->_mainQuery) {
         if ($this->hasAttribute('id')) {
             $this->_mainQuery->andFilterWhere(['id' => $this->id]);
         }
         if ($this->hasAttribute('created_at')) {
             $this->_mainQuery->andFilterWhere(['like', 'created_at', $this->created_at]);
         }
         if ($this->hasAttribute('updated_at')) {
             $this->_mainQuery->andFilterWhere(['like', 'updated_at', $this->updated_at]);
         }
     }
 }
開發者ID:platx,項目名稱:yii2-active-record,代碼行數:17,代碼來源:ActiveRecord.php

示例3: filtersForExtraColumns

 /**
  * @param ActiveQuery $query
  */
 protected function filtersForExtraColumns($query)
 {
     foreach (self::extraColumns() as $attribute) {
         $query->andFilterWhere(['like', self::columnName($attribute, false), $this->getAttribute($attribute)]);
     }
 }
開發者ID:GAMITG,項目名稱:yz2-admin,代碼行數:9,代碼來源:WithExtraColumns.php

示例4: createdAtQueryModifier

 /**
  * Поиск по диапазону дат создания
  * @param \yii\db\ActiveQuery $q
  * @param \common\db\fields\Field $f
  */
 public function createdAtQueryModifier($q, $f)
 {
     $table = $f->model->tableName();
     $attr = $f->attr;
     $toDate = $f->model->createdAtTo ? $f->model->createdAtTo . " 23:59:59" : $f->model->createdAtTo;
     $q->andFilterWhere([">=", "{{%{$table}}}.{{%{$attr}}}", $f->model->createdAtFrom]);
     $q->andFilterWhere(["<=", "{{%{$table}}}.{{%{$attr}}}", $toDate]);
 }
開發者ID:frostiks25,項目名稱:rzwebsys7,代碼行數:13,代碼來源:MetaFields.php

示例5: filterUserId

 /**
  * @param $userId
  * @param ActiveQuery $query
  */
 protected function filterUserId($userId, $query)
 {
     if (strlen($this->user_id)) {
         if (!is_numeric($userId) && ($callback = Audit::getInstance()->userFilterCallback)) {
             $userId = call_user_func($callback, $userId);
         } else {
             $userId = intval($this->user_id) ?: 0;
         }
     }
     $query->andFilterWhere(['user_id' => $userId]);
 }
開發者ID:SaschaScholly,項目名稱:yii2-audit,代碼行數:15,代碼來源:AuditEntrySearch.php

示例6: equal

 public function equal($attribute)
 {
     $this->query->andFilterWhere([$attribute => $this->model->{$attribute}]);
 }
開發者ID:vladdnepr,項目名稱:yii2-ycm,代碼行數:4,代碼來源:SearchQuery.php

示例7: prepareFilters

 /**
  * @param ActiveQuery $query
  */
 protected function prepareFilters($query)
 {
     $query->andFilterWhere(['id' => $this->id, 'is_super_admin' => $this->is_super_admin, 'is_active' => $this->is_active]);
     $query->andFilterWhere(['like', 'login', $this->login])->andFilterWhere(['like', 'passhash', $this->passhash])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'email', $this->email]);
 }
開發者ID:omnilight,項目名稱:yz2-admin,代碼行數:8,代碼來源:UserSearch.php


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