@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public function getTableName($table) |
45 | 45 | { |
46 | - return '{{%' . str_replace($this->db->tablePrefix, '', $table->name) . '}}'; |
|
46 | + return '{{%'.str_replace($this->db->tablePrefix, '', $table->name).'}}'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | |
54 | 54 | |
55 | - return '$this->batchInsert("{{%test}}", ' . $rows . ', ' . $columns . ');'; |
|
55 | + return '$this->batchInsert("{{%test}}", '.$rows.', '.$columns.');'; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | foreach ($data as $row) { |
77 | 77 | $rows = ''; |
78 | 78 | foreach ($row as $value) { |
79 | - $rows .= "'" . addslashes($value) . "',"; |
|
79 | + $rows .= "'".addslashes($value)."',"; |
|
80 | 80 | } |
81 | - self::$rows .= "\n\t\t\t" . self::dataFormat($rows) . ","; |
|
81 | + self::$rows .= "\n\t\t\t".self::dataFormat($rows).","; |
|
82 | 82 | } |
83 | 83 | if (!empty(self::$rows)) { |
84 | 84 | return self::dataFormat(self::$rows); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | if (null !== $trim) { |
97 | 97 | $data = rtrim($data, $trim); |
98 | 98 | } |
99 | - return self::$dataEncloser[0] . $data . self::$dataEncloser[1]; |
|
99 | + return self::$dataEncloser[0].$data.self::$dataEncloser[1]; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $data = rtrim($data, $trim); |
111 | 111 | } |
112 | 112 | |
113 | - return self::$columnEncloser[0] . rtrim($data, $trim) . self::$columnEncloser[1]; |
|
113 | + return self::$columnEncloser[0].rtrim($data, $trim).self::$columnEncloser[1]; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | throw new Exception("The 'db' option must refer to the application component ID of a DB connection."); |
79 | 79 | } |
80 | 80 | |
81 | - $path = (string)Yii::getAlias($this->migrationPath); |
|
81 | + $path = (string) Yii::getAlias($this->migrationPath); |
|
82 | 82 | |
83 | 83 | |
84 | 84 | if (!is_dir($path)) { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | protected function getCreateTableSql($table) |
175 | 175 | { |
176 | - $row = $this->db->createCommand('SHOW CREATE TABLE ' . $this->quoteTableName($table->fullName))->queryOne(); |
|
176 | + $row = $this->db->createCommand('SHOW CREATE TABLE '.$this->quoteTableName($table->fullName))->queryOne(); |
|
177 | 177 | if (isset($row['Create Table'])) { |
178 | 178 | $sql = $row['Create Table']; |
179 | 179 | } else { |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | public function actionTable(array $tables) |
200 | 200 | { |
201 | 201 | |
202 | - if ($this->confirm('Create the migration ' . "?")) { |
|
202 | + if ($this->confirm('Create the migration '."?")) { |
|
203 | 203 | |
204 | 204 | foreach ($tables as $key => $tableName) { |
205 | 205 | |
206 | - $this->class = 'create_table_' . $tableName; |
|
206 | + $this->class = 'create_table_'.$tableName; |
|
207 | 207 | |
208 | 208 | try { |
209 | 209 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $this->table = $this->getTableName($table); |
229 | 229 | |
230 | 230 | foreach ($table->columns as $col) { |
231 | - $up .= "\t\t\t" . '\'' . $col->name . '\'=>"' . $this->getColType($col) . '",' . "\n"; |
|
231 | + $up .= "\t\t\t".'\''.$col->name.'\'=>"'.$this->getColType($col).'",'."\n"; |
|
232 | 232 | if ($col->isPrimaryKey) { |
233 | 233 | // Add column to composite primary key array |
234 | 234 | $compositePrimaryKeyCols[] = $col->name; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | $ukeys = $this->db->schema->findUniqueIndexes($table); |
239 | 239 | if (!empty($ukeys)) { |
240 | - $indexArr =[]; |
|
240 | + $indexArr = []; |
|
241 | 241 | foreach ($ukeys as $key => $value) { |
242 | 242 | $indexKey = $key; |
243 | 243 | foreach ($value as $id => $field) { |
@@ -245,15 +245,15 @@ discard block |
||
245 | 245 | } |
246 | 246 | } |
247 | 247 | $indexStr = implode(',', $indexArr); |
248 | - $up .= "\t\t" . '$this->createIndex(\'idx_' . $indexKey . "', '" . $this->getTableName($table) . "', '$indexStr', TRUE);\n"; |
|
248 | + $up .= "\t\t".'$this->createIndex(\'idx_'.$indexKey."', '".$this->getTableName($table)."', '$indexStr', TRUE);\n"; |
|
249 | 249 | |
250 | 250 | } |
251 | 251 | |
252 | 252 | if (!empty($table->foreignKeys)): |
253 | 253 | |
254 | 254 | foreach ($table->foreignKeys as $fkName => $fk) { |
255 | - $addForeignKeys .= "\t\t" . '$this->addForeignKey("' . $fkName . '", "' . $table->name . '", "' . $fk['column'] . '","' . $fk['table'] . '","' . $fk['ref_column'] . '", "' . $fk['delete'] . '", "' . $fk['update'] . '");' . "\n"; |
|
256 | - $dropForeignKeys .= '$this->dropForeignKey(' . "'$fkName', '$table->name');"; |
|
255 | + $addForeignKeys .= "\t\t".'$this->addForeignKey("'.$fkName.'", "'.$table->name.'", "'.$fk['column'].'","'.$fk['table'].'","'.$fk['ref_column'].'", "'.$fk['delete'].'", "'.$fk['update'].'");'."\n"; |
|
256 | + $dropForeignKeys .= '$this->dropForeignKey('."'$fkName', '$table->name');"; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | endif; |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | $fields = $this->parseFields(); |
264 | 264 | |
265 | - $this->prepareFile(['up' => '', 'down' => '', 'foreignKeys' => $table->foreignKeys, 'fields' => $fields]) . "\n\n"; |
|
265 | + $this->prepareFile(['up' => '', 'down' => '', 'foreignKeys' => $table->foreignKeys, 'fields' => $fields])."\n\n"; |
|
266 | 266 | |
267 | 267 | } |
268 | 268 | |
@@ -278,11 +278,11 @@ discard block |
||
278 | 278 | public function actionData(array $tables) |
279 | 279 | { |
280 | 280 | |
281 | - if ($this->confirm('Create the migration ' . "?", true)) { |
|
281 | + if ($this->confirm('Create the migration '."?", true)) { |
|
282 | 282 | foreach ($tables as $key => $args) { |
283 | 283 | |
284 | 284 | $table = $args; |
285 | - $this->class = 'insert_data_into_' . $table; |
|
285 | + $this->class = 'insert_data_into_'.$table; |
|
286 | 286 | $this->table = $table; |
287 | 287 | $this->templateFile = '@tmukherjee13/migration/views/dataTemplate.php'; |
288 | 288 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | $pcolumns = ''; |
312 | 312 | foreach ($columns->columns as $column) { |
313 | - $pcolumns .= "'" . $column->name . "',"; |
|
313 | + $pcolumns .= "'".$column->name."',"; |
|
314 | 314 | } |
315 | 315 | foreach ($data as $row) { |
316 | 316 | array_push($prepared_data, $row); |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | { |
343 | 343 | |
344 | 344 | $schema = $args; |
345 | - $this->class = 'dump_database_' . $schema; |
|
345 | + $this->class = 'dump_database_'.$schema; |
|
346 | 346 | |
347 | 347 | // $tables = $this->db->schema->getTableNames($schema); |
348 | 348 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $generateTables = []; |
358 | 358 | |
359 | 359 | foreach ($tables as $table) { |
360 | - if ($table->name === $this->db->tablePrefix . $this->migrationTable) { |
|
360 | + if ($table->name === $this->db->tablePrefix.$this->migrationTable) { |
|
361 | 361 | continue; |
362 | 362 | } |
363 | 363 | $generateTables[] = $table->name; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | |
370 | 370 | public function getFileName() |
371 | 371 | { |
372 | - return 'm' . gmdate('ymd_His') . '_' . $this->class; |
|
372 | + return 'm'.gmdate('ymd_His').'_'.$this->class; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | public function setFileName() |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | |
380 | 380 | public function prepareFile($data) |
381 | 381 | { |
382 | - $file = $this->migrationPath . DIRECTORY_SEPARATOR . $this->getFileName() . '.php'; |
|
382 | + $file = $this->migrationPath.DIRECTORY_SEPARATOR.$this->getFileName().'.php'; |
|
383 | 383 | try { |
384 | 384 | |
385 | 385 | $data['table'] = $this->table; |