1 | <?php |
||||
2 | |||||
3 | use Itstructure\AdminModule\components\MultilanguageMigration; |
||||
4 | use Itstructure\AdminModule\models\Language; |
||||
5 | |||||
6 | /** |
||||
7 | * Handles the creation of table `language`. |
||||
8 | */ |
||||
9 | class m171202_104405_create_language_table extends MultilanguageMigration |
||||
10 | { |
||||
11 | /** |
||||
12 | * @inheritdoc |
||||
13 | */ |
||||
14 | public function up() |
||||
15 | { |
||||
16 | $this->createTableWithTimestamps(Language::tableName(), [ |
||||
17 | 'id' => $this->primaryKey(), |
||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
18 | 'locale' => $this->string(8), |
||||
0 ignored issues
–
show
The method
string() does not exist on m171202_104405_create_language_table . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
19 | 'shortName' => $this->string(3), |
||||
20 | 'name' => $this->string(64), |
||||
21 | 'default' => $this->tinyInteger(2) |
||||
0 ignored issues
–
show
The method
tinyInteger() does not exist on m171202_104405_create_language_table . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
22 | ->notNull() |
||||
23 | ->defaultValue(0), |
||||
24 | ]); |
||||
25 | $now = (new \DateTime())->format('Y-m-d H:i:s'); |
||||
26 | $this->db->createCommand() |
||||
27 | ->insert(Language::tableName(), [ |
||||
28 | 'locale' => 'en-EN', |
||||
29 | 'shortName' => 'en', |
||||
30 | 'name' => 'English', |
||||
31 | 'default' => 1, |
||||
32 | 'created_at' => $now, |
||||
33 | 'updated_at' => $now, |
||||
34 | ]) |
||||
35 | ->execute(); |
||||
36 | } |
||||
37 | |||||
38 | /** |
||||
39 | * @inheritdoc |
||||
40 | */ |
||||
41 | public function down() |
||||
42 | { |
||||
43 | $this->dropTable(Language::tableName()); |
||||
44 | } |
||||
45 | } |
||||
46 |