Total Complexity | 6 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
13 | class FormIgnoreAdd extends Model |
||
14 | { |
||
15 | public $id; |
||
16 | public $comment; |
||
17 | |||
18 | private $_user; |
||
19 | |||
20 | /** |
||
21 | * FormIgnoreAdd constructor. Pass user object inside. |
||
22 | * @param iUser $user |
||
23 | */ |
||
24 | public function __construct(iUser $user) |
||
25 | { |
||
26 | $this->_user = $user; |
||
27 | parent::__construct(true); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Labels for form |
||
32 | * @return array |
||
33 | */ |
||
34 | public function labels(): array |
||
35 | { |
||
36 | return [ |
||
37 | 'id' => __('User ID'), |
||
38 | 'comment' => __('Comment') |
||
39 | ]; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Validation rules |
||
44 | */ |
||
45 | public function rules(): array |
||
46 | { |
||
47 | return [ |
||
48 | ['id', 'required'], |
||
49 | ['comment', 'used'], |
||
50 | ['id', 'int'], |
||
51 | ['id', 'App::$User::isExist'] |
||
52 | ]; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Make save |
||
57 | * @return bool |
||
58 | */ |
||
59 | public function save() |
||
74 | } |
||
75 | } |
||
76 |