Class yii\debug\models\search\Profile

Inheritanceyii\debug\models\search\Profile » yii\debug\models\search\Base » yii\base\Model
Available since extension's version2.0
Source Code https://github.com/yiisoft/yii2-debug/blob/master/src/models/search/Profile.php

Search model for current request profiling log.

Public Properties

Hide inherited properties

Property Type Description Defined By
$category string Method attribute input search value yii\debug\models\search\Profile
$info integer Info attribute input search value yii\debug\models\search\Profile

Public Methods

Hide inherited methods

Method Description Defined By
addCondition() Adds filtering condition for a given attribute yii\debug\models\search\Base
attributeLabels() yii\debug\models\search\Profile
rules() yii\debug\models\search\Profile
search() Returns data provider with filled models. Filter applied if needed. yii\debug\models\search\Profile

Property Details

Hide inherited properties

$category public property

Method attribute input search value

public string $category null
$info public property

Info attribute input search value

public integer $info null

Method Details

Hide inherited methods

addCondition() public method

Defined in: yii\debug\models\search\Base::addCondition()

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]));
    }
}

            
attributeLabels() public method

public void attributeLabels ( )

                public function attributeLabels()
{
    return [
        'category' => 'Category',
        'info' => 'Info',
    ];
}

            
rules() public method

public void rules ( )

                public function rules()
{
    return [
        [['category', 'info'], 'safe'],
    ];
}

            
search() public method

Returns data provider with filled models. Filter applied if needed.

public \yii\data\ArrayDataProvider search ( $params, $models )
$params array

An array of parameter values indexed by parameter names

$models array

Data to return provider for

                public function search($params, $models)
{
    $dataProvider = new ArrayDataProvider([
        'allModels' => $models,
        'pagination' => false,
        'sort' => [
            'attributes' => ['category', 'seq', 'duration', 'info'],
            'defaultOrder' => [
                'duration' => SORT_DESC,
            ],
        ],
    ]);
    if (!($this->load($params) && $this->validate())) {
        return $dataProvider;
    }
    $filter = new Filter();
    $this->addCondition($filter, 'category', true);
    $this->addCondition($filter, 'info', true);
    $dataProvider->allModels = $filter->filter($models);
    return $dataProvider;
}