1 | <?php |
||
2 | |||
3 | namespace andmemasin\myabstract; |
||
4 | |||
5 | use andmemasin\myabstract\traits\ModelWithHasStatusTrait; |
||
6 | use yii\base\InvalidConfigException; |
||
7 | |||
8 | /** |
||
9 | * Class ModelWithHasStatus |
||
10 | * |
||
11 | * @property string $status |
||
12 | * |
||
13 | * |
||
14 | * @package andmemasin\myabstract |
||
15 | * @author Tonis Ormisson <[email protected]> |
||
16 | */ |
||
17 | class ModelWithHasStatus extends MyActiveRecord |
||
18 | { |
||
19 | use ModelWithHasStatusTrait; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
20 | |||
21 | /** @var string */ |
||
22 | public $statusModelClass; |
||
23 | |||
24 | /** @var string */ |
||
25 | public static $hasStatusClassName; |
||
26 | |||
27 | /** @var string */ |
||
28 | protected $initialStatus = StatusModel::STATUS_CREATED; |
||
29 | |||
30 | public function init() |
||
31 | { |
||
32 | if (!static::$hasStatusClassName) { |
||
33 | throw new InvalidConfigException('hasStatusClassName must be set for ' . static::class); |
||
34 | } |
||
35 | |||
36 | parent::init(); |
||
37 | } |
||
38 | |||
39 | |||
40 | } |