@@ -51,15 +51,17 @@ |
||
51 | 51 | |
52 | 52 | $template = str_replace("§NAME§", $migrationName, $this->template); |
53 | 53 | |
54 | - if(isset($connectionName)) |
|
55 | - $template = str_replace("§CONNECTION§", 'protected $connection = "'.$connectionName.'";', $template); |
|
56 | - else |
|
57 | - $template = str_replace("§CONNECTION§", '', $template); |
|
54 | + if(isset($connectionName)) { |
|
55 | + $template = str_replace("§CONNECTION§", 'protected $connection = "'.$connectionName.'";', $template); |
|
56 | + } else { |
|
57 | + $template = str_replace("§CONNECTION§", '', $template); |
|
58 | + } |
|
58 | 59 | |
59 | - if(isset($tableName)) |
|
60 | - $template = str_replace("§TABLE§", 'protected $table = "'.$tableName.'";', $template); |
|
61 | - else |
|
62 | - $template = str_replace("§TABLE§", '', $template); |
|
60 | + if(isset($tableName)) { |
|
61 | + $template = str_replace("§TABLE§", 'protected $table = "'.$tableName.'";', $template); |
|
62 | + } else { |
|
63 | + $template = str_replace("§TABLE§", '', $template); |
|
64 | + } |
|
63 | 65 | |
64 | 66 | $File = new File($migrationName.".php", new Storage("model")); |
65 | 67 | //$File->setContents($template); |
@@ -52,8 +52,9 @@ discard block |
||
52 | 52 | $class->up(); |
53 | 53 | } |
54 | 54 | |
55 | - if (count($this->migrations) > 0) |
|
56 | - $output->writeln("Migration successful"); |
|
55 | + if (count($this->migrations) > 0) { |
|
56 | + $output->writeln("Migration successful"); |
|
57 | + } |
|
57 | 58 | } |
58 | 59 | |
59 | 60 | private function setMigrations(ConsoleOutput $output) |
@@ -66,13 +67,15 @@ discard block |
||
66 | 67 | $filesInNamespace = new ArrayObject(scandir(ROOT_PATH."/".$path."/")); |
67 | 68 | $filesInNamespace->removeFirst()->removeFirst(); |
68 | 69 | |
69 | - for ($i = 0; $i <= $filesInNamespace->count()-1; $i++) |
|
70 | - $filesInNamespace->key($i, explode(".php", $filesInNamespace->key($i))[0]); |
|
70 | + for ($i = 0; $i <= $filesInNamespace->count()-1; $i++) { |
|
71 | + $filesInNamespace->key($i, explode(".php", $filesInNamespace->key($i))[0]); |
|
72 | + } |
|
71 | 73 | |
72 | 74 | foreach ($filesInNamespace->val() as $value) { |
73 | 75 | $class = $namespace.$value; |
74 | - if(class_exists($class) && is_subclass_of($class,'app\framework\Component\Database\Migrations\Migration')) |
|
75 | - $classes[$value] = new $class(); |
|
76 | + if(class_exists($class) && is_subclass_of($class,'app\framework\Component\Database\Migrations\Migration')) { |
|
77 | + $classes[$value] = new $class(); |
|
78 | + } |
|
76 | 79 | } |
77 | 80 | |
78 | 81 | // tell user so if there are no migrations |
@@ -87,8 +90,9 @@ discard block |
||
87 | 90 | { |
88 | 91 | $migrationInstance = null; |
89 | 92 | $class = $this->namespace.$migration; |
90 | - if(class_exists($class) && is_subclass_of($class,'app\framework\Component\Database\Migrations\Migration')) |
|
91 | - $migrationInstance = new $class(); |
|
93 | + if(class_exists($class) && is_subclass_of($class,'app\framework\Component\Database\Migrations\Migration')) { |
|
94 | + $migrationInstance = new $class(); |
|
95 | + } |
|
92 | 96 | |
93 | 97 | if($migrationInstance == null) { |
94 | 98 | $output->writeln("Migration not found"); |