@@ -1,12 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -use Behat\Behat\Tester\Exception\PendingException; |
|
4 | 3 | use Behat\Behat\Context\Context; |
5 | 4 | use Behat\Behat\Context\SnippetAcceptingContext; |
6 | 5 | use Behat\Gherkin\Node\PyStringNode; |
7 | -use Behat\Gherkin\Node\TableNode; |
|
8 | 6 | use Behat\Behat\Hook\Scope\AfterScenarioScope; |
9 | - |
|
10 | 7 | use Symfony\Component\Finder\Finder; |
11 | 8 | |
12 | 9 | /** |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | - * @Given I run :command |
|
51 | - */ |
|
50 | + * @Given I run :command |
|
51 | + */ |
|
52 | 52 | public function iRun($command) |
53 | 53 | { |
54 | 54 | exec($command); |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
85 | - * @AfterScenario |
|
86 | - */ |
|
87 | - public function deleteMigrations(AfterScenarioScope $scope) |
|
88 | - { |
|
89 | - $pattern = getcwd() . '/' . $this->dir . '/*.php'; |
|
90 | - array_map('unlink', glob($pattern)); |
|
91 | - } |
|
85 | + * @AfterScenario |
|
86 | + */ |
|
87 | + public function deleteMigrations(AfterScenarioScope $scope) |
|
88 | + { |
|
89 | + $pattern = getcwd() . '/' . $this->dir . '/*.php'; |
|
90 | + array_map('unlink', glob($pattern)); |
|
91 | + } |
|
92 | 92 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | public function iSeeTheFileWitchNameContains($fileName) |
61 | 61 | { |
62 | 62 | $this->fileName = $fileName; |
63 | - $pattern = getcwd() . '/' . $this->dir; |
|
64 | - if (count((new Finder())->files()->in($pattern)->name('*' . $fileName)) === 0) { |
|
63 | + $pattern = getcwd().'/'.$this->dir; |
|
64 | + if (count((new Finder())->files()->in($pattern)->name('*'.$fileName)) === 0) { |
|
65 | 65 | throw new \Exception('File does not exist'); |
66 | 66 | } |
67 | 67 | } |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function thisFileBodyContains(PyStringNode $string) |
73 | 73 | { |
74 | - $pattern = getcwd() . '/' . $this->dir; |
|
74 | + $pattern = getcwd().'/'.$this->dir; |
|
75 | 75 | $content = ''; |
76 | - foreach ((new Finder())->files()->in($pattern)->name('*' . $this->fileName) as $file) { |
|
76 | + foreach ((new Finder())->files()->in($pattern)->name('*'.$this->fileName) as $file) { |
|
77 | 77 | $content = $file->getContents(); |
78 | 78 | } |
79 | 79 | if (strpos($content, $string->getRaw()) === false) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function deleteMigrations(AfterScenarioScope $scope) |
88 | 88 | { |
89 | - $pattern = getcwd() . '/' . $this->dir . '/*.php'; |
|
89 | + $pattern = getcwd().'/'.$this->dir.'/*.php'; |
|
90 | 90 | array_map('unlink', glob($pattern)); |
91 | 91 | } |
92 | 92 | } |
@@ -2,10 +2,10 @@ |
||
2 | 2 | |
3 | 3 | namespace Dami\Cli\Command; |
4 | 4 | |
5 | -use Symfony\Component\Console\Command\Command, |
|
6 | - Symfony\Component\Console\Input\InputOption, |
|
7 | - Symfony\Component\Console\Input\InputInterface, |
|
8 | - Symfony\Component\Console\Output\OutputInterface; |
|
5 | +use Symfony\Component\Console\Command\Command; |
|
6 | +use Symfony\Component\Console\Input\InputOption; |
|
7 | +use Symfony\Component\Console\Input\InputInterface; |
|
8 | +use Symfony\Component\Console\Output\OutputInterface; |
|
9 | 9 | |
10 | 10 | |
11 | 11 | class AbstractCommand extends Command |
@@ -18,10 +18,10 @@ |
||
18 | 18 | /** |
19 | 19 | * Constructor. |
20 | 20 | * |
21 | - * @param string $table Table name. |
|
22 | 21 | * @param Schema $schema |
23 | 22 | * @param Manipulation $manipulation |
24 | 23 | * @param array $actions |
24 | + * @param string $name |
|
25 | 25 | */ |
26 | 26 | public function __construct($name, Schema $schema = null, Manipulation $manipulation, &$actions) |
27 | 27 | { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $column->setTable($this); |
62 | 62 | |
63 | 63 | $this->actions[] = function () use ($column) { |
64 | - return $this->manipulation->drop($column); |
|
64 | + return $this->manipulation->drop($column); |
|
65 | 65 | }; |
66 | 66 | |
67 | 67 | return $this; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $foreignKey->setDeleteAction($options['delete']); |
96 | 96 | } |
97 | 97 | $this->actions[] = function () use ($foreignKey) { |
98 | - return $this->manipulation->create($foreignKey); |
|
98 | + return $this->manipulation->create($foreignKey); |
|
99 | 99 | }; |
100 | 100 | |
101 | 101 | return $this; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $foreignKey->setReferencedColumns($referenceColumns); |
120 | 120 | |
121 | 121 | $this->actions[] = function () use ($foreignKey) { |
122 | - return $this->manipulation->drop($foreignKey); |
|
122 | + return $this->manipulation->drop($foreignKey); |
|
123 | 123 | }; |
124 | 124 | |
125 | 125 | return $this; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $unique = new Unique($columns, $this); |
138 | 138 | |
139 | 139 | $this->actions[] = function () use ($unique) { |
140 | - return $this->manipulation->create($unique); |
|
140 | + return $this->manipulation->create($unique); |
|
141 | 141 | }; |
142 | 142 | |
143 | 143 | return $this; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $unique = new Unique($columns, $this); |
156 | 156 | |
157 | 157 | $this->actions[] = function () use ($unique) { |
158 | - return $this->manipulation->drop($unique); |
|
158 | + return $this->manipulation->drop($unique); |
|
159 | 159 | }; |
160 | 160 | |
161 | 161 | return $this; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $index = new Index($columns, $this); |
174 | 174 | |
175 | 175 | $this->actions[] = function () use ($index) { |
176 | - return $this->manipulation->create($index); |
|
176 | + return $this->manipulation->create($index); |
|
177 | 177 | }; |
178 | 178 | |
179 | 179 | return $this; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $index = new Index($columns, $this); |
192 | 192 | |
193 | 193 | $this->actions[] = function () use ($index) { |
194 | - return $this->manipulation->drop($index); |
|
194 | + return $this->manipulation->drop($index); |
|
195 | 195 | }; |
196 | 196 | |
197 | 197 | return $this; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $column = new TextColumn($name); |
61 | 61 | $column->setTable($this); |
62 | 62 | |
63 | - $this->actions[] = function () use ($column) { |
|
63 | + $this->actions[] = function() use ($column) { |
|
64 | 64 | return $this->manipulation->drop($column); |
65 | 65 | }; |
66 | 66 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | if (isset($options['delete'])) { |
95 | 95 | $foreignKey->setDeleteAction($options['delete']); |
96 | 96 | } |
97 | - $this->actions[] = function () use ($foreignKey) { |
|
97 | + $this->actions[] = function() use ($foreignKey) { |
|
98 | 98 | return $this->manipulation->create($foreignKey); |
99 | 99 | }; |
100 | 100 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $foreignKey->setColumns($referenceColumns); |
119 | 119 | $foreignKey->setReferencedColumns($referenceColumns); |
120 | 120 | |
121 | - $this->actions[] = function () use ($foreignKey) { |
|
121 | + $this->actions[] = function() use ($foreignKey) { |
|
122 | 122 | return $this->manipulation->drop($foreignKey); |
123 | 123 | }; |
124 | 124 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | { |
137 | 137 | $unique = new Unique($columns, $this); |
138 | 138 | |
139 | - $this->actions[] = function () use ($unique) { |
|
139 | + $this->actions[] = function() use ($unique) { |
|
140 | 140 | return $this->manipulation->create($unique); |
141 | 141 | }; |
142 | 142 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | { |
155 | 155 | $unique = new Unique($columns, $this); |
156 | 156 | |
157 | - $this->actions[] = function () use ($unique) { |
|
157 | + $this->actions[] = function() use ($unique) { |
|
158 | 158 | return $this->manipulation->drop($unique); |
159 | 159 | }; |
160 | 160 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | { |
173 | 173 | $index = new Index($columns, $this); |
174 | 174 | |
175 | - $this->actions[] = function () use ($index) { |
|
175 | + $this->actions[] = function() use ($index) { |
|
176 | 176 | return $this->manipulation->create($index); |
177 | 177 | }; |
178 | 178 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | { |
191 | 191 | $index = new Index($columns, $this); |
192 | 192 | |
193 | - $this->actions[] = function () use ($index) { |
|
193 | + $this->actions[] = function() use ($index) { |
|
194 | 194 | return $this->manipulation->drop($index); |
195 | 195 | }; |
196 | 196 |
@@ -87,7 +87,7 @@ |
||
87 | 87 | return $finder |
88 | 88 | ->files() |
89 | 89 | ->in($this->path) |
90 | - ->sort(function (\SplFileInfo $a, \SplFileInfo $b) use ($migrateUp) { |
|
90 | + ->sort(function(\SplFileInfo $a, \SplFileInfo $b) use ($migrateUp) { |
|
91 | 91 | return $migrateUp |
92 | 92 | ? $a->getRealpath() > $b->getRealpath() |
93 | 93 | : $a->getRealpath() < $b->getRealpath(); |
@@ -4,6 +4,6 @@ |
||
4 | 4 | |
5 | 5 | abstract class Direction |
6 | 6 | { |
7 | - const UP = 'up'; |
|
8 | - const DOWN = 'down'; |
|
7 | + const UP = 'up'; |
|
8 | + const DOWN = 'down'; |
|
9 | 9 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $table->setDescription($options['comment']); |
54 | 54 | } |
55 | 55 | $this->actions[] = function () use ($table) { |
56 | - return $this->manipulation->create($table); |
|
56 | + return $this->manipulation->create($table); |
|
57 | 57 | }; |
58 | 58 | |
59 | 59 | return $table; |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | |
75 | 75 | $cascade = isset($options['cascade']) ? $options['cascade'] : true; |
76 | 76 | $this->actions[] = function () use ($table, $cascade) { |
77 | - return $this->manipulation->drop($table, $cascade); |
|
78 | - }; |
|
77 | + return $this->manipulation->drop($table, $cascade); |
|
78 | + }; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | { |
105 | 105 | $schema = new Schema($name); |
106 | 106 | $this->actions[] = function () use ($schema) { |
107 | - return $this->manipulation->create($schema); |
|
108 | - }; |
|
107 | + return $this->manipulation->create($schema); |
|
108 | + }; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | { |
120 | 120 | $schema = new Schema($name); |
121 | 121 | $this->actions[] = function () use ($schema) { |
122 | - return $this->manipulation->drop($schema); |
|
123 | - }; |
|
122 | + return $this->manipulation->drop($schema); |
|
123 | + }; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | if (isset($options['comment'])) { |
53 | 53 | $table->setDescription($options['comment']); |
54 | 54 | } |
55 | - $this->actions[] = function () use ($table) { |
|
55 | + $this->actions[] = function() use ($table) { |
|
56 | 56 | return $this->manipulation->create($table); |
57 | 57 | }; |
58 | 58 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $table = new Table($name, $schema); |
74 | 74 | |
75 | 75 | $cascade = isset($options['cascade']) ? $options['cascade'] : true; |
76 | - $this->actions[] = function () use ($table, $cascade) { |
|
76 | + $this->actions[] = function() use ($table, $cascade) { |
|
77 | 77 | return $this->manipulation->drop($table, $cascade); |
78 | 78 | }; |
79 | 79 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | public function createSchema($name) |
104 | 104 | { |
105 | 105 | $schema = new Schema($name); |
106 | - $this->actions[] = function () use ($schema) { |
|
106 | + $this->actions[] = function() use ($schema) { |
|
107 | 107 | return $this->manipulation->create($schema); |
108 | 108 | }; |
109 | 109 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function dropSchema($name) |
119 | 119 | { |
120 | 120 | $schema = new Schema($name); |
121 | - $this->actions[] = function () use ($schema) { |
|
121 | + $this->actions[] = function() use ($schema) { |
|
122 | 122 | return $this->manipulation->drop($schema); |
123 | 123 | }; |
124 | 124 | } |
@@ -21,11 +21,11 @@ |
||
21 | 21 | $this->container = $container; |
22 | 22 | } |
23 | 23 | |
24 | - /** |
|
25 | - * Gets container instance. |
|
26 | - * |
|
27 | - * @return ContainerInterface |
|
28 | - */ |
|
24 | + /** |
|
25 | + * Gets container instance. |
|
26 | + * |
|
27 | + * @return ContainerInterface |
|
28 | + */ |
|
29 | 29 | protected function getContainer() |
30 | 30 | { |
31 | 31 | return $this->container; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | } else { |
41 | 41 | $output->writeln(sprintf('<comment>No migrations detected.</comment>')); |
42 | 42 | } |
43 | - } catch(\PDOException $e) { |
|
43 | + } catch(\PDOException $e) { |
|
44 | 44 | $output->writeln("\n<error>There was something wrong during migration. Database schema has not been changed.</error>"); |
45 | 45 | if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
46 | 46 | $output->writeln(sprintf("\n<error>%s</error>", $e->getMessage())); |
@@ -40,7 +40,7 @@ |
||
40 | 40 | } else { |
41 | 41 | $output->writeln(sprintf('<comment>No migrations detected.</comment>')); |
42 | 42 | } |
43 | - } catch(\PDOException $e) { |
|
43 | + } catch (\PDOException $e) { |
|
44 | 44 | $output->writeln("\n<error>There was something wrong during migration. Database schema has not been changed.</error>"); |
45 | 45 | if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
46 | 46 | $output->writeln(sprintf("\n<error>%s</error>", $e->getMessage())); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | } |
32 | 32 | $this->defineParameters($container); |
33 | - if(!$container->hasParameter('dami.migrations_directory')) { |
|
33 | + if(!$container->hasParameter('dami.migrations_directory')) { |
|
34 | 34 | $container->setParameter('dami.migrations_directory', getcwd() . '/migrations'); |
35 | 35 | } |
36 | 36 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $container->setDefinition('dami.verbosity', $definition); |
64 | 64 | |
65 | 65 | $definition = new Definition('Dami\EventListener\SqlSubscriber', |
66 | - [new Reference('dami.verbosity')]); |
|
66 | + [new Reference('dami.verbosity')]); |
|
67 | 67 | $definition->addTag('kernel.event_subscriber'); |
68 | 68 | $container->setDefinition('dami.sql.subscriber', $definition); |
69 | 69 | } |
@@ -30,8 +30,8 @@ |
||
30 | 30 | } |
31 | 31 | } |
32 | 32 | $this->defineParameters($container); |
33 | - if(!$container->hasParameter('dami.migrations_directory')) { |
|
34 | - $container->setParameter('dami.migrations_directory', getcwd() . '/migrations'); |
|
33 | + if (!$container->hasParameter('dami.migrations_directory')) { |
|
34 | + $container->setParameter('dami.migrations_directory', getcwd().'/migrations'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $definition = new Definition('%dami.migration_name_parser.class%'); |