Completed
Push — master ( 80fd4c...ece9a3 )
by Paweł
03:01
created

Account::scenarios()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created for IG Monitoring.
4
 * User: jakim <[email protected]>
5
 * Date: 23.01.2018
6
 */
7
8
namespace app\modules\admin\models;
9
10
11
use app\components\ArrayHelper;
12
13
/**
14
 * @inheritdoc
15
 *
16
 * @property \app\models\AccountStats $lastStats
17
 */
18
class Account extends \app\models\Account
19
{
20
    const SCENARIO_UPDATE = 'update';
21
22
    public $as_followed_by;
23
    public $as_follows;
24
    public $as_media;
25
    public $as_er;
26
    public $as_created_at;
27
28
    public $s_tags;
29
30
    public function scenarios()
31
    {
32
        $scenarios = parent::scenarios();
33
        $scenarios[self::SCENARIO_UPDATE] = [
34
            'name',
35
            'accounts_monitoring_level'
36
        ];
37
38
        return $scenarios;
39
    }
40
41
    public function getLastStats()
42
    {
43
        return $this->getLastAccountStats();
44
    }
45
46
    public function attributeLabels()
47
    {
48
        return ArrayHelper::merge(parent::attributeLabels(), [
49
            'as_followed_by' => 'Followed By',
50
            'as_follows' => 'Follows',
51
            'as_media' => 'Media',
52
            'as_er' => 'Er',
53
            's_tags' => 'Tags',
54
            'as_created_at' => 'Created At',
55
        ]);
56
    }
57
58
    public function getAccountStats()
59
    {
60
        return $this->hasMany(AccountStats::class, ['account_id' => 'id']);
61
    }
62
}