@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function actionUpData($limit = 0) |
104 | 104 | { |
105 | - $this->migrationPath .= DIRECTORY_SEPARATOR . $this->dataMigrationFolder; |
|
105 | + $this->migrationPath .= DIRECTORY_SEPARATOR.$this->dataMigrationFolder; |
|
106 | 106 | return parent::actionUp($limit); |
107 | 107 | } |
108 | 108 | |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function actionData(array $tables) |
120 | 120 | { |
121 | - if ($this->confirm('Create the migration ' . "?", TRUE)) { |
|
121 | + if ($this->confirm('Create the migration '."?", TRUE)) { |
|
122 | 122 | foreach ($tables as $key => $args) { |
123 | 123 | |
124 | 124 | $table = $args; |
125 | - $this->class = 'insert_data_into_' . $table; |
|
125 | + $this->class = 'insert_data_into_'.$table; |
|
126 | 126 | $this->table = $table; |
127 | 127 | $this->templateFile = '@tmukherjee13/migration/views/dataTemplate.php'; |
128 | 128 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | $pcolumns = ''; |
152 | 152 | foreach ($columns->columns as $column) { |
153 | - $pcolumns .= "'" . $column->name . "',"; |
|
153 | + $pcolumns .= "'".$column->name."',"; |
|
154 | 154 | } |
155 | 155 | foreach ($data as $row) { |
156 | 156 | array_push($prepared_data, $row); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $prows = $this->prepareData($prepared_data); |
164 | 164 | |
165 | 165 | if ($this->useDataMigrationFolder) { |
166 | - $path = $this->migrationPath . DIRECTORY_SEPARATOR . $this->dataMigrationFolder; |
|
166 | + $path = $this->migrationPath.DIRECTORY_SEPARATOR.$this->dataMigrationFolder; |
|
167 | 167 | FileHelper::createDirectory($path); |
168 | 168 | $this->migrationPath = $path; |
169 | 169 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function getFileName() |
183 | 183 | { |
184 | - return 'm' . gmdate('ymd_His') . '_' . $this->class; |
|
184 | + return 'm'.gmdate('ymd_His').'_'.$this->class; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function prepareFile($data) |
202 | 202 | { |
203 | - $file = $this->migrationPath . DIRECTORY_SEPARATOR . $this->getFileName() . '.php'; |
|
203 | + $file = $this->migrationPath.DIRECTORY_SEPARATOR.$this->getFileName().'.php'; |
|
204 | 204 | try { |
205 | 205 | |
206 | 206 | $data['table'] = $this->table; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | { |
227 | 227 | |
228 | 228 | $schema = $args; |
229 | - $this->class = 'dump_database_' . $schema; |
|
229 | + $this->class = 'dump_database_'.$schema; |
|
230 | 230 | $tables = $this->db->schema->getTableSchemas($schema); |
231 | 231 | $addForeignKeys = ''; |
232 | 232 | $dropForeignKeys = ''; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $generateTables = []; |
239 | 239 | |
240 | 240 | foreach ($tables as $table) { |
241 | - if ($table->name === $this->db->tablePrefix . $this->migrationTable) { |
|
241 | + if ($table->name === $this->db->tablePrefix.$this->migrationTable) { |
|
242 | 242 | continue; |
243 | 243 | } |
244 | 244 | $generateTables[] = $table->name; |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | public function actionTable(array $tables) |
261 | 261 | { |
262 | 262 | |
263 | - if (!$this->confirm('Create the migration ' . "?")) { |
|
263 | + if (!$this->confirm('Create the migration '."?")) { |
|
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
267 | 267 | foreach ($tables as $key => $tableName) { |
268 | 268 | |
269 | - $this->class = 'create_table_' . $tableName; |
|
269 | + $this->class = 'create_table_'.$tableName; |
|
270 | 270 | |
271 | 271 | try { |
272 | 272 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $this->table = $this->getTableName($table); |
293 | 293 | |
294 | 294 | foreach ($table->columns as $col) { |
295 | - $up .= "\t\t\t" . '\'' . $col->name . '\'=>"' . $this->getColType($col) . '",' . "\n"; |
|
295 | + $up .= "\t\t\t".'\''.$col->name.'\'=>"'.$this->getColType($col).'",'."\n"; |
|
296 | 296 | if ($col->isPrimaryKey) { |
297 | 297 | // Add column to composite primary key array |
298 | 298 | $compositePrimaryKeyCols[] = $col->name; |
@@ -309,15 +309,15 @@ discard block |
||
309 | 309 | } |
310 | 310 | } |
311 | 311 | $indexStr = implode(',', $indexArr); |
312 | - $up .= "\t\t" . '$this->createIndex(\'idx_' . $indexKey . "', '" . $this->getTableName($table) . "', '$indexStr', TRUE);\n"; |
|
312 | + $up .= "\t\t".'$this->createIndex(\'idx_'.$indexKey."', '".$this->getTableName($table)."', '$indexStr', TRUE);\n"; |
|
313 | 313 | |
314 | 314 | } |
315 | 315 | |
316 | 316 | if (!empty($table->foreignKeys)): |
317 | 317 | |
318 | 318 | foreach ($table->foreignKeys as $fkName => $fk) { |
319 | - $addForeignKeys .= "\t\t" . '$this->addForeignKey("' . $fkName . '", "' . $table->name . '", "' . $fk['column'] . '","' . $fk['table'] . '","' . $fk['ref_column'] . '", "' . $fk['delete'] . '", "' . $fk['update'] . '");' . "\n"; |
|
320 | - $dropForeignKeys .= '$this->dropForeignKey(' . "'$fkName', '$table->name');"; |
|
319 | + $addForeignKeys .= "\t\t".'$this->addForeignKey("'.$fkName.'", "'.$table->name.'", "'.$fk['column'].'","'.$fk['table'].'","'.$fk['ref_column'].'", "'.$fk['delete'].'", "'.$fk['update'].'");'."\n"; |
|
320 | + $dropForeignKeys .= '$this->dropForeignKey('."'$fkName', '$table->name');"; |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | endif; |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | 'foreignKeys' => $table->foreignKeys, |
333 | 333 | 'fields' => $fields, |
334 | 334 | 'indexes' => $this->findIndexes($table), |
335 | - ]) . "\n\n"; |
|
335 | + ])."\n\n"; |
|
336 | 336 | |
337 | 337 | } |
338 | 338 | } |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | */ |
418 | 418 | protected function getCreateTableSql(TableSchema $table) |
419 | 419 | { |
420 | - $row = $this->db->createCommand('SHOW CREATE TABLE ' . $this->quoteTableName($table->fullName))->queryOne(); |
|
420 | + $row = $this->db->createCommand('SHOW CREATE TABLE '.$this->quoteTableName($table->fullName))->queryOne(); |
|
421 | 421 | if (isset($row['Create Table'])) { |
422 | 422 | $sql = $row['Create Table']; |
423 | 423 | } else { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function getTableName($table) |
47 | 47 | { |
48 | - return '{{%' . str_replace($this->db->tablePrefix, '', $table->name) . '}}'; |
|
48 | + return '{{%'.str_replace($this->db->tablePrefix, '', $table->name).'}}'; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function prepareInsert($rows, $columns) |
58 | 58 | { |
59 | - return '$this->batchInsert("{{%test}}", ' . $rows . ', ' . $columns . ');'; |
|
59 | + return '$this->batchInsert("{{%test}}", '.$rows.', '.$columns.');'; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $data = rtrim($data, $trim); |
85 | 85 | } |
86 | 86 | |
87 | - return self::$columnEncloser[0] . rtrim($data, $trim) . self::$columnEncloser[1]; |
|
87 | + return self::$columnEncloser[0].rtrim($data, $trim).self::$columnEncloser[1]; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | foreach ($data as $row) { |
101 | 101 | $rows = ''; |
102 | 102 | foreach ($row as $value) { |
103 | - $rows .= "'" . addslashes($value) . "',"; |
|
103 | + $rows .= "'".addslashes($value)."',"; |
|
104 | 104 | } |
105 | - self::$rows .= "\n\t\t\t" . self::dataFormat($rows) . ","; |
|
105 | + self::$rows .= "\n\t\t\t".self::dataFormat($rows).","; |
|
106 | 106 | } |
107 | 107 | if (!empty(self::$rows)) { |
108 | 108 | return self::dataFormat(self::$rows); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | if (NULL !== $trim) { |
123 | 123 | $data = rtrim($data, $trim); |
124 | 124 | } |
125 | - return self::$dataEncloser[0] . $data . self::$dataEncloser[1]; |
|
125 | + return self::$dataEncloser[0].$data.self::$dataEncloser[1]; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -2,7 +2,7 @@ |
||
2 | 2 | /* @var $table string the name table */ |
3 | 3 | /* @var $indexes array the foreign keys */ |
4 | 4 | |
5 | -if($indexes){ |
|
5 | +if ($indexes) { |
|
6 | 6 | foreach ($indexes as $key => $index): ?> |
7 | 7 | $this->dropIndex('<?= $key ?>', $this->tableName); |
8 | 8 | <?php endforeach; |
@@ -8,16 +8,16 @@ |
||
8 | 8 | |
9 | 9 | //dd( $indexes ); |
10 | 10 | |
11 | -if($indexes){ |
|
11 | +if ($indexes) { |
|
12 | 12 | foreach ($indexes as $index): |
13 | - if(is_string($index['Column_name'])): ?> |
|
14 | - <?php if($index['Non_unique'] == 0): ?> |
|
13 | + if (is_string($index['Column_name'])): ?> |
|
14 | + <?php if ($index['Non_unique'] == 0): ?> |
|
15 | 15 | $this->createIndex('<?= str_replace('_UNIQUE', '', $index['Key_name'])?>', $this->tableName, '<?= $index['Column_name'] ?>', true); |
16 | 16 | <?php else: ?> |
17 | 17 | $this->createIndex('<?= $index['Key_name'] ?>', $this->tableName, '<?= $index['Column_name'] ?>'); |
18 | 18 | <?php endif; ?> |
19 | 19 | <?php else: ?> |
20 | - $this->createIndex('<?= $index['Key_name'] ?>', $this->tableName, ['<?= implode("','",$index['Column_name']) ?>']); |
|
20 | + $this->createIndex('<?= $index['Key_name'] ?>', $this->tableName, ['<?= implode("','", $index['Column_name']) ?>']); |
|
21 | 21 | <?php endif; ?> |
22 | 22 | <?php endforeach; |
23 | 23 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | <?php foreach ($fields as $field): |
14 | 14 | if (!empty($field['decorators'])): ?> |
15 | 15 | <?= "'{$field['property']}' => \$this->{$field['decorators']}" ?>, |
16 | - <?php elseif(!empty('raw')): ?> |
|
16 | + <?php elseif (!empty('raw')): ?> |
|
17 | 17 | <?=$field['raw'] ?>, |
18 | 18 | <?php else: ?> |
19 | 19 | '<?= $field['property'] ?>', |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | <?= $this->render('_addForeignKeys', [ |
25 | 25 | 'table' => $table, |
26 | 26 | 'foreignKeys' => $foreignKeys, |
27 | -]);?> |
|
27 | +]); ?> |
|
28 | 28 | |
29 | 29 | <?= $this->render('_addIndexes', [ |
30 | 30 | 'table' => $table, |