1 | <?php |
||
14 | /** |
||
15 | * Class Options |
||
16 | * @package Inji\Db |
||
17 | * |
||
18 | * @property int $id |
||
19 | * @property string $connect_name |
||
20 | * @property string $connect_alias |
||
21 | * @property string $driver |
||
22 | * @property string $host |
||
23 | * @property string $user |
||
24 | * @property string $pass |
||
25 | * @property string $db_name |
||
26 | * @property string $encoding |
||
27 | * @property string $table_prefix |
||
28 | * @property string $port |
||
29 | */ |
||
30 | class Options extends \Inji\Model { |
||
31 | |||
32 | /** |
||
33 | * Model options |
||
34 | */ |
||
35 | public static $objectName = 'Db options'; |
||
36 | public static $labels = [ |
||
37 | 'id' => '#', |
||
38 | 'connect_name' => 'Название', |
||
39 | 'connect_alias' => 'Алиас', |
||
40 | 'driver' => 'Тип базы', |
||
41 | 'host' => 'Хост', |
||
42 | 'user' => 'Пользователь', |
||
43 | 'pass' => 'Пароль', |
||
44 | 'db_name' => 'Название базы', |
||
45 | 'encoding' => 'Кодировка', |
||
46 | 'table_prefix' => 'Префикс', |
||
47 | 'port' => 'порт', |
||
48 | ]; |
||
49 | public static $cols = [ |
||
50 | 'id' => ['type' => 'pk'], |
||
51 | 'connect_name' => ['type' => 'text', 'default' => 'local'], |
||
52 | 'connect_alias' => ['type' => 'text', 'default' => 'local'], |
||
53 | 'driver' => ['type' => 'select', 'source' => 'array', 'sourceArray' => ['Mysql' => 'Mysql']], |
||
54 | 'host' => ['type' => 'text', 'default' => 'localhost'], |
||
55 | 'user' => ['type' => 'text', 'default' => 'root'], |
||
56 | 'pass' => ['type' => 'text'], |
||
57 | 'db_name' => ['type' => 'text', 'default' => 'test'], |
||
58 | 'encoding' => ['type' => 'text', 'default' => 'utf8'], |
||
59 | 'table_prefix' => ['type' => 'text', 'default' => 'inji_'], |
||
60 | 'port' => ['type' => 'text', 'default' => '3306'], |
||
61 | ]; |
||
62 | public static $dataManagers = [ |
||
63 | 'setup' => [ |
||
64 | 'name' => 'Настройки соединения с БД', |
||
65 | 'options' => [ |
||
66 | 'access' => [ |
||
67 | 'apps' => [ |
||
68 | 'setup' |
||
69 | ] |
||
70 | ] |
||
71 | ], |
||
72 | 'cols' => [ |
||
73 | 'connect_name', |
||
74 | 'connect_alias', |
||
75 | 'db_name' |
||
76 | ], |
||
77 | 'editForm' => 'setup', |
||
78 | ] |
||
79 | ]; |
||
80 | public static $forms = [ |
||
81 | 'setup' => [ |
||
82 | 'name' => 'Соединение с БД', |
||
83 | 'options' => [ |
||
84 | 'access' => [ |
||
85 | 'apps' => [ |
||
86 | 'setup' |
||
87 | ] |
||
88 | ] |
||
89 | ], |
||
90 | 'map' => [ |
||
91 | ['connect_name', 'connect_alias', 'driver'], |
||
92 | ['host', 'user'], |
||
93 | ['pass', 'db_name'], |
||
114 |