| @@ 14-46 (lines=33) @@ | ||
| 11 | ||
| 12 | namespace Ecommerce; |
|
| 13 | ||
| 14 | class Unit extends \Model |
|
| 15 | { |
|
| 16 | public static $objectName = 'Единица измерения'; |
|
| 17 | public static $labels = [ |
|
| 18 | 'name' => 'Название', |
|
| 19 | 'code' => 'Код', |
|
| 20 | 'international' => 'Международное обозначение', |
|
| 21 | ]; |
|
| 22 | public static $cols = [ |
|
| 23 | //Основные параметры |
|
| 24 | 'name' => ['type' => 'text'], |
|
| 25 | 'code' => ['type' => 'text'], |
|
| 26 | //Системные |
|
| 27 | 'international' => ['type' => 'text'], |
|
| 28 | 'date_create' => ['type' => 'dateTime'], |
|
| 29 | ]; |
|
| 30 | public static $dataManagers = [ |
|
| 31 | 'manager' => [ |
|
| 32 | 'name' => 'Единицы измерения', |
|
| 33 | 'cols' => [ |
|
| 34 | 'name', 'code', 'international' |
|
| 35 | ] |
|
| 36 | ] |
|
| 37 | ]; |
|
| 38 | public static $forms = [ |
|
| 39 | 'manager' => [ |
|
| 40 | 'map' => [ |
|
| 41 | ['name', 'code', 'international'] |
|
| 42 | ] |
|
| 43 | ] |
|
| 44 | ]; |
|
| 45 | ||
| 46 | } |
|
| 47 | ||
| @@ 14-51 (lines=38) @@ | ||
| 11 | ||
| 12 | namespace Geography; |
|
| 13 | ||
| 14 | class Country extends \Model |
|
| 15 | { |
|
| 16 | public static $objectName = 'Страна'; |
|
| 17 | public static $labels = [ |
|
| 18 | 'name' => 'Название', |
|
| 19 | 'city' => 'Город', |
|
| 20 | 'date_create' => 'Дата создания', |
|
| 21 | ]; |
|
| 22 | public static $cols = [ |
|
| 23 | 'name' => ['type' => 'text'], |
|
| 24 | 'city' => ['type' => 'dataManager', 'relation' => 'citys'], |
|
| 25 | 'date_create' => ['type' => 'dateTime'], |
|
| 26 | ]; |
|
| 27 | public static $dataManagers = [ |
|
| 28 | 'manager' => [ |
|
| 29 | 'cols' => ['name', 'city', 'date_create'] |
|
| 30 | ] |
|
| 31 | ]; |
|
| 32 | public static $forms = [ |
|
| 33 | 'manager' => [ |
|
| 34 | 'map' => [ |
|
| 35 | ['name'] |
|
| 36 | ] |
|
| 37 | ] |
|
| 38 | ]; |
|
| 39 | ||
| 40 | public static function relations() |
|
| 41 | { |
|
| 42 | return [ |
|
| 43 | 'citys' => [ |
|
| 44 | 'type' => 'many', |
|
| 45 | 'model' => 'Geography\City', |
|
| 46 | 'col' => 'country_id' |
|
| 47 | ] |
|
| 48 | ]; |
|
| 49 | } |
|
| 50 | ||
| 51 | } |
|
| 52 | ||