Class yii\debug\models\search\Mail

Inheritanceyii\debug\models\search\Mail » 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/Mail.php

Mail represents the model behind the search form about current send emails.

Public Properties

Hide inherited properties

Property Type Description Defined By
$bcc string Bcc attribute input search value yii\debug\models\search\Mail
$body string Body attribute input search value yii\debug\models\search\Mail
$cc string Cc attribute input search value yii\debug\models\search\Mail
$charset string Charset attribute input search value yii\debug\models\search\Mail
$file string File attribute input search value yii\debug\models\search\Mail
$from string From attribute input search value yii\debug\models\search\Mail
$headers string Headers attribute input search value yii\debug\models\search\Mail
$reply string Reply attribute input search value yii\debug\models\search\Mail
$subject string Subject attribute input search value yii\debug\models\search\Mail
$to string To attribute input search value yii\debug\models\search\Mail

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\Mail
rules() yii\debug\models\search\Mail
search() Returns data provider with filled models. Filter applied if needed. yii\debug\models\search\Mail

Property Details

Hide inherited properties

$bcc public property

Bcc attribute input search value

public string $bcc null
$body public property

Body attribute input search value

public string $body null
$cc public property

Cc attribute input search value

public string $cc null
$charset public property

Charset attribute input search value

public string $charset null
$file public property

File attribute input search value

public string $file null
$from public property

From attribute input search value

public string $from null
$headers public property

Headers attribute input search value

public string $headers null
$reply public property

Reply attribute input search value

public string $reply null
$subject public property

Subject attribute input search value

public string $subject null
$to public property

To attribute input search value

public string $to 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 [
        'from' => 'From',
        'to' => 'To',
        'reply' => 'Reply',
        'cc' => 'Copy receiver',
        'bcc' => 'Hidden copy receiver',
        'subject' => 'Subject',
        'charset' => 'Charset'
    ];
}

            
rules() public method

public void rules ( )

                public function rules()
{
    return [
        [['from', 'to', 'reply', 'cc', 'bcc', 'subject', 'body', 'charset'], 'safe'],
    ];
}

            
search() public method

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

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

                public function search($params, $models)
{
    $dataProvider = new ArrayDataProvider([
        'allModels' => $models,
        'pagination' => [
            'pageSize' => 20,
        ],
        'sort' => [
            'attributes' => ['from', 'to', 'reply', 'cc', 'bcc', 'subject', 'body', 'charset'],
        ],
    ]);
    if (!($this->load($params) && $this->validate())) {
        return $dataProvider;
    }
    $filter = new Filter();
    $this->addCondition($filter, 'from', true);
    $this->addCondition($filter, 'to', true);
    $this->addCondition($filter, 'reply', true);
    $this->addCondition($filter, 'cc', true);
    $this->addCondition($filter, 'bcc', true);
    $this->addCondition($filter, 'subject', true);
    $this->addCondition($filter, 'body', true);
    $this->addCondition($filter, 'charset', true);
    $dataProvider->allModels = $filter->filter($models);
    return $dataProvider;
}