Class yii\debug\models\search\Debug
Inheritance | yii\debug\models\search\Debug » yii\debug\models\search\Base » yii\base\Model |
---|---|
Available since extension's version | 2.0 |
Source Code | https://github.com/yiisoft/yii2-debug/blob/master/src/models/search/Debug.php |
Search model for requests manifest data.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$ajax | integer | Ajax attribute input search value | yii\debug\models\search\Debug |
$criticalCodes | array | Critical codes, used to determine grid row options. | yii\debug\models\search\Debug |
$ip | string | Ip attribute input search value | yii\debug\models\search\Debug |
$mailCount | integer | Total mail count attribute input search value | yii\debug\models\search\Debug |
$method | string | Method attribute input search value | yii\debug\models\search\Debug |
$sqlCount | integer | Sql count attribute input search value | yii\debug\models\search\Debug |
$statusCode | string | Status code attribute input search value | yii\debug\models\search\Debug |
$tag | string | Tag attribute input search value | yii\debug\models\search\Debug |
$url | string | Url attribute input search value | yii\debug\models\search\Debug |
Public Methods
Method | Description | Defined By |
---|---|---|
addCondition() | Adds filtering condition for a given attribute | yii\debug\models\search\Base |
attributeLabels() | yii\debug\models\search\Debug | |
isCodeCritical() | Checks if code is critical. | yii\debug\models\search\Debug |
rules() | yii\debug\models\search\Debug | |
search() | Returns data provider with filled models. Filter applied if needed. | yii\debug\models\search\Debug |
Property Details
Critical codes, used to determine grid row options.
Total mail count attribute input search value
Status code attribute input search value
Method Details
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 = $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]));
}
}
public void attributeLabels ( ) |
public function attributeLabels()
{
return [
'tag' => 'Tag',
'ip' => 'Ip',
'method' => 'Method',
'ajax' => 'Ajax',
'url' => 'url',
'statusCode' => 'Status code',
'sqlCount' => 'Query Count',
'mailCount' => 'Mail Count',
];
}
Checks if code is critical.
public boolean isCodeCritical ( $code ) | ||
$code | integer |
public function isCodeCritical($code)
{
return in_array($code, $this->criticalCodes, false);
}
public void rules ( ) |
public function rules()
{
return [
[['tag', 'ip', 'method', 'ajax', 'url', 'statusCode', 'sqlCount', 'mailCount'], 'safe'],
];
}
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,
'sort' => [
'attributes' => ['method', 'ip', 'tag', 'time', 'statusCode', 'sqlCount', 'mailCount'],
],
'pagination' => [
'pageSize' => 50,
],
]);
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
$filter = new Filter();
$this->addCondition($filter, 'tag', true);
$this->addCondition($filter, 'ip', true);
$this->addCondition($filter, 'method');
$this->addCondition($filter, 'ajax');
$this->addCondition($filter, 'url', true);
$this->addCondition($filter, 'statusCode');
$this->addCondition($filter, 'sqlCount');
$this->addCondition($filter, 'mailCount');
$dataProvider->allModels = $filter->filter($models);
return $dataProvider;
}