@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public static function setUpBeforeClass() |
25 | 25 | { |
26 | - unlink(__DIR__ . '/Config/sqlite.db'); |
|
26 | + unlink(__DIR__.'/Config/sqlite.db'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | protected function setUp() |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | new ReadModelField('f1', new Boolean()), |
44 | 44 | new ReadModelField('f2', new TextString(10)), |
45 | 45 | ], |
46 | - function ($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2']]); }, |
|
47 | - function () {} |
|
46 | + function($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2']]); }, |
|
47 | + function() {} |
|
48 | 48 | ); |
49 | 49 | |
50 | 50 | $this->writer->writeRecord($meta, ['id' => 1, 'f1' => true, 'f2' => 'test']); |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | new ReadModelField('f2', new TextString(10)), |
65 | 65 | new ReadModelField('f3', new TextString(10)), |
66 | 66 | ], |
67 | - function ($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2'], 'f3' => $data['f2']]); }, |
|
68 | - function () {} |
|
67 | + function($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2'], 'f3' => $data['f2']]); }, |
|
68 | + function() {} |
|
69 | 69 | ); |
70 | 70 | |
71 | 71 | $this->writer->writeRecord($meta, ['id' => 2, 'f1' => true, 'f2' => 'test']); |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | new ReadModelField('f1', new Boolean()), |
85 | 85 | new ReadModelField('f2', new TextString(10)) |
86 | 86 | ], |
87 | - function ($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2']]); }, |
|
88 | - function () {} |
|
87 | + function($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2']]); }, |
|
88 | + function() {} |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | $this->writer->writeRecord($meta, ['id' => 2, 'f1' => true, 'f2' => 'test2']); |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | new ReadModelField('f1', new Boolean()), |
105 | 105 | new ReadModelField('f2', new TextString(10)), |
106 | 106 | ], |
107 | - function ($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2']]); }, |
|
108 | - function () {}, |
|
107 | + function($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2']]); }, |
|
108 | + function() {}, |
|
109 | 109 | 'created_at' |
110 | 110 | ); |
111 | 111 |
@@ -21,8 +21,7 @@ |
||
21 | 21 | public function generateSnapshot() { return $this->snapshotColumnName !== null; } |
22 | 22 | public function getSnapshotColumnName() { return $this->snapshotColumnName; } |
23 | 23 | |
24 | - public function __construct |
|
25 | - ( |
|
24 | + public function __construct( |
|
26 | 25 | $name, |
27 | 26 | ReadModelId $id, |
28 | 27 | array $fields, |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $container->setParameter('rapido.table_name_suffix', $config['table_name_suffix']); |
18 | 18 | $container->setParameter('rapido.id_column_name', $config['id_column_name']); |
19 | 19 | |
20 | - $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
20 | + $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
21 | 21 | $loader->load('services.xml'); |
22 | 22 | } |
23 | 23 |
@@ -15,11 +15,11 @@ |
||
15 | 15 | |
16 | 16 | public function generate($id) |
17 | 17 | { |
18 | - return $this->prefix . (string) $id; |
|
18 | + return $this->prefix.(string) $id; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function generateWithSuffix($id) |
22 | 22 | { |
23 | - return $this->generate($id) . $this->suffix; |
|
23 | + return $this->generate($id).$this->suffix; |
|
24 | 24 | } |
25 | 25 | } |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | |
41 | 41 | $this->updateTable($table); |
42 | 42 | |
43 | - if (!$metadata->generateSnapshot()) return; |
|
43 | + if (!$metadata->generateSnapshot()) { |
|
44 | + return; |
|
45 | + } |
|
44 | 46 | |
45 | 47 | $table = $this->generateTable($metadata, true); |
46 | 48 | $table->setPrimaryKey([$this->idColumnName, $metadata->getSnapshotColumnName()]); |
@@ -72,13 +74,15 @@ discard block |
||
72 | 74 | function(Table $existingTable) use ($table) { return $table->getName() == $existingTable->getName(); } |
73 | 75 | ); |
74 | 76 | |
75 | - if (count($existingTables) > 1) |
|
76 | - throw new \UnexpectedValueException(sprintf("Multiple tables with the name '%s' exist.", $table->getName())); |
|
77 | + if (count($existingTables) > 1) { |
|
78 | + throw new \UnexpectedValueException(sprintf("Multiple tables with the name '%s' exist.", $table->getName())); |
|
79 | + } |
|
77 | 80 | |
78 | 81 | if (count($existingTables) == 1) { |
79 | 82 | $tableDiff = $this->schemaComparator->diffTable(current($existingTables), $table); |
80 | - if ($tableDiff) |
|
81 | - $this->schemaManager->alterTable($tableDiff); |
|
83 | + if ($tableDiff) { |
|
84 | + $this->schemaManager->alterTable($tableDiff); |
|
85 | + } |
|
82 | 86 | } else { |
83 | 87 | $this->schemaManager->createTable($table); |
84 | 88 | } |