@@ 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 |
@@ 10-54 (lines=45) @@ | ||
7 | * Модель опции условий доставки - тега option в секции delivery-option |
|
8 | * @package pastuhov\ymlcatalog\models |
|
9 | */ |
|
10 | class ParamOffer extends BaseModel |
|
11 | { |
|
12 | /** |
|
13 | * @inheritdoc |
|
14 | */ |
|
15 | public static $tag = 'param'; |
|
16 | ||
17 | /** |
|
18 | * @inheritdoc |
|
19 | */ |
|
20 | public static $tagProperties = [ |
|
21 | 'name', |
|
22 | 'unit', |
|
23 | ]; |
|
24 | ||
25 | /** @var string Название параметра. */ |
|
26 | public $name; |
|
27 | ||
28 | /** @var string Единицы измерения. */ |
|
29 | public $unit; |
|
30 | ||
31 | /** @var string Значение параметра. */ |
|
32 | public $value; |
|
33 | ||
34 | /** |
|
35 | * @inheritdoc |
|
36 | */ |
|
37 | public function rules() |
|
38 | { |
|
39 | return [ |
|
40 | [ |
|
41 | ['name', 'value'], |
|
42 | 'required', |
|
43 | ], |
|
44 | [ |
|
45 | ['cost'], |
|
46 | 'integer', |
|
47 | ], |
|
48 | [ |
|
49 | ['name', 'value', 'unit'], |
|
50 | 'string', |
|
51 | ], |
|
52 | ]; |
|
53 | } |
|
54 | } |
|
55 |