Class yii\debug\models\search\Base

Inheritanceyii\debug\models\search\Base » yii\base\Model
Subclassesyii\debug\models\search\Db, yii\debug\models\search\Debug, yii\debug\models\search\Event, yii\debug\models\search\Log, yii\debug\models\search\Mail, yii\debug\models\search\Profile, yii\debug\models\timeline\Search
Available since extension's version2.0
Source Code https://github.com/yiisoft/yii2-debug/blob/master/src/models/search/Base.php

Base search model

Public Methods

Hide inherited methods

Method Description Defined By
addCondition() Adds filtering condition for a given attribute yii\debug\models\search\Base

Method Details

Hide inherited methods

addCondition() public method

Adds filtering condition for a given attribute

public void addCondition ( yii\debug\components\search\Filter $filter, $attribute, $partial false )
$filter yii\debug\components\search\Filter

Filter instance

$attribute string

Attribute to filter

$partial boolean

If partial match should be used

                public function addCondition(Filter $filter, $attribute, $partial = false)
{
    $value = (string)$this->$attribute;
    if (mb_strpos($value, '>') !== false) {
        $value = (int)str_replace('>', '', $value);
        $filter->addMatcher($attribute, new matchers\GreaterThan(['value' => $value]));
    } elseif (mb_strpos($value, '<') !== false) {
        $value = (int)str_replace('<', '', $value);
        $filter->addMatcher($attribute, new matchers\LowerThan(['value' => $value]));
    } else {
        $filter->addMatcher($attribute, new matchers\SameAs(['value' => $value, 'partial' => $partial]));
    }
}