1 | <?php |
||
14 | class Image extends \Model { |
||
15 | |||
16 | public static $objectName = 'Фото товара'; |
||
17 | public static $labels = [ |
||
18 | 'file_id' => 'Изображение', |
||
19 | 'item_id' => 'Товар', |
||
20 | 'name' => 'Название', |
||
21 | 'description' => 'Описание', |
||
22 | ]; |
||
23 | public static $cols = [ |
||
24 | 'file_id' => ['type' => 'image'], |
||
25 | 'item_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'item'], |
||
26 | 'name' => ['type' => 'text'], |
||
27 | 'description' => ['type' => 'html'], |
||
28 | 'weight' => ['type' => 'number'], |
||
29 | ]; |
||
30 | |||
31 | public static function relations() { |
||
43 | |||
44 | public static $dataManagers = [ |
||
45 | 'manager' => [ |
||
46 | 'name' => 'Фото товара', |
||
47 | 'cols' => [ |
||
48 | 'file_id', 'name' |
||
49 | ] |
||
50 | ] |
||
51 | ]; |
||
52 | public static $forms = [ |
||
53 | 'manager' => [ |
||
54 | 'map' => [ |
||
55 | ['name'], |
||
56 | ['item_id', 'file_id'], |
||
57 | ['description'] |
||
58 | ] |
||
59 | ] |
||
60 | ]; |
||
61 | |||
62 | public function beforeSave() { |
||
69 | |||
70 | public function beforeDelete() { |
||
75 | } |