@@ 8-48 (lines=41) @@ | ||
5 | * Class Category |
|
6 | * @package pastuhov\ymlcatalog\models |
|
7 | */ |
|
8 | class Category extends BaseModel |
|
9 | { |
|
10 | /** |
|
11 | * @inheritdoc |
|
12 | */ |
|
13 | public static $tag = 'category'; |
|
14 | ||
15 | /** |
|
16 | * @inheritdoc |
|
17 | */ |
|
18 | public static $tagProperties = [ |
|
19 | 'id', |
|
20 | 'parentId', |
|
21 | ]; |
|
22 | ||
23 | public $name; |
|
24 | public $parentId; |
|
25 | public $id; |
|
26 | ||
27 | /** |
|
28 | * @inheritdoc |
|
29 | */ |
|
30 | public function rules() |
|
31 | { |
|
32 | return [ |
|
33 | [ |
|
34 | ['id', 'name'], |
|
35 | 'required', |
|
36 | ], |
|
37 | [ |
|
38 | ['name'], |
|
39 | 'string', |
|
40 | 'max' => 255, |
|
41 | ], |
|
42 | [ |
|
43 | ['id', 'parentId'], |
|
44 | 'integer', |
|
45 | ], |
|
46 | ]; |
|
47 | } |
|
48 | } |
|
49 |
@@ 8-55 (lines=48) @@ | ||
5 | * Class DeliveryOption |
|
6 | * @package pastuhov\ymlcatalog\models |
|
7 | */ |
|
8 | class DeliveryOption extends BaseModel |
|
9 | { |
|
10 | /** |
|
11 | * @inheritdoc |
|
12 | */ |
|
13 | public static $tag = 'option'; |
|
14 | ||
15 | /** |
|
16 | * @inheritdoc |
|
17 | */ |
|
18 | public static $tagProperties = [ |
|
19 | 'cost', |
|
20 | 'days', |
|
21 | ]; |
|
22 | ||
23 | public $cost; |
|
24 | public $days; |
|
25 | ||
26 | /** |
|
27 | * @inheritdoc |
|
28 | */ |
|
29 | public function rules() |
|
30 | { |
|
31 | return [ |
|
32 | [ |
|
33 | ['cost', 'days'], |
|
34 | 'required', |
|
35 | ], |
|
36 | [ |
|
37 | ['cost'], |
|
38 | 'integer', |
|
39 | ], |
|
40 | [ |
|
41 | ['days'], |
|
42 | 'string', |
|
43 | 'max' => 5, |
|
44 | ], |
|
45 | ]; |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * @inheritdoc |
|
50 | */ |
|
51 | protected function getYmlBody() |
|
52 | { |
|
53 | return null; |
|
54 | } |
|
55 | } |
|
56 |