Conditions | 2 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | public function rules() |
||
28 | { |
||
29 | return array_merge(parent::rules(), [ |
||
30 | [ |
||
31 | ['stage_id'], |
||
32 | 'exist', |
||
33 | 'skipOnError' => true, |
||
34 | 'targetClass' => Stage::class, |
||
35 | 'targetAttribute' => ['stage_id' => 'id'], |
||
36 | 'on' => [self::SCENARIO_INITIAL], |
||
37 | 'filter' => function ($q) { |
||
38 | if (!$this->process->hasErrors()) { |
||
39 | $q->andWhere([ |
||
40 | 'workflow_id' => $this->process->workflow_id, |
||
|
|||
41 | ]); |
||
42 | } |
||
43 | }, |
||
44 | 'message' => 'Stage "{value}" does not belong to the workflow.', |
||
45 | ], |
||
49 |