本文整理汇总了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]);
}
}
}
示例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]);
}
}
}
示例3: filtersForExtraColumns
/**
* @param ActiveQuery $query
*/
protected function filtersForExtraColumns($query)
{
foreach (self::extraColumns() as $attribute) {
$query->andFilterWhere(['like', self::columnName($attribute, false), $this->getAttribute($attribute)]);
}
}
示例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]);
}
示例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]);
}
示例6: equal
public function equal($attribute)
{
$this->query->andFilterWhere([$attribute => $this->model->{$attribute}]);
}
示例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]);
}