@@ -29,8 +29,9 @@ |
||
| 29 | 29 | public function getAllRecords() |
| 30 | 30 | { |
| 31 | 31 | $allRecords = $this->allRecords; |
| 32 | - foreach ($allRecords() as $recordData) |
|
| 33 | - yield $recordData; |
|
| 32 | + foreach ($allRecords() as $recordData) { |
|
| 33 | + yield $recordData; |
|
| 34 | + } |
|
| 34 | 35 | } |
| 35 | 36 | |
| 36 | 37 | /** @return Record */ |
@@ -12,8 +12,9 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function __construct($totalDigits, $fractionalDigits) |
| 14 | 14 | { |
| 15 | - if ($totalDigits <= $fractionalDigits) |
|
| 16 | - throw new \InvalidArgumentException("'totalDigits' ({$totalDigits}) has to be larger than 'fractionalDigits' ({$fractionalDigits})"); |
|
| 15 | + if ($totalDigits <= $fractionalDigits) { |
|
| 16 | + throw new \InvalidArgumentException("'totalDigits' ({$totalDigits}) has to be larger than 'fractionalDigits' ({$fractionalDigits})"); |
|
| 17 | + } |
|
| 17 | 18 | |
| 18 | 19 | $this->totalDigits = $totalDigits; |
| 19 | 20 | $this->fractionalDigits = $fractionalDigits; |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $this->updateTable($table); |
| 43 | 43 | |
| 44 | - if (!$metadata->generateSnapshot()) return; |
|
| 44 | + if (!$metadata->generateSnapshot()) { |
|
| 45 | + return; |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | $table = $this->generateTable($metadata, true); |
| 47 | 49 | $table->setPrimaryKey([$this->idColumnName, $metadata->getSnapshotColumnName()]); |
@@ -64,7 +66,9 @@ discard block |
||
| 64 | 66 | |
| 65 | 67 | return new Table($name, |
| 66 | 68 | array_merge($predefinedColumns, array_map(function(ReadModelField $field) use (&$indices) { |
| 67 | - if ($field->useIndex()) $indices[] = new Index(sprintf('IDX_%s', $field->getId()), [$field->getId()]); |
|
| 69 | + if ($field->useIndex()) { |
|
| 70 | + $indices[] = new Index(sprintf('IDX_%s', $field->getId()), [$field->getId()]); |
|
| 71 | + } |
|
| 68 | 72 | |
| 69 | 73 | return $this->columnFactory->createColumn($field->getDataType(), $field->getId()); |
| 70 | 74 | }, $metadata->getFields())), |
@@ -79,13 +83,15 @@ discard block |
||
| 79 | 83 | function(Table $existingTable) use ($table) { return $table->getName() == $existingTable->getName(); } |
| 80 | 84 | ); |
| 81 | 85 | |
| 82 | - if (count($existingTables) > 1) |
|
| 83 | - throw new \UnexpectedValueException(sprintf("Multiple tables with the name '%s' exist.", $table->getName())); |
|
| 86 | + if (count($existingTables) > 1) { |
|
| 87 | + throw new \UnexpectedValueException(sprintf("Multiple tables with the name '%s' exist.", $table->getName())); |
|
| 88 | + } |
|
| 84 | 89 | |
| 85 | 90 | if (count($existingTables) == 1) { |
| 86 | 91 | $tableDiff = $this->schemaComparator->diffTable(current($existingTables), $table); |
| 87 | - if ($tableDiff) |
|
| 88 | - $this->schemaManager->alterTable($tableDiff); |
|
| 92 | + if ($tableDiff) { |
|
| 93 | + $this->schemaManager->alterTable($tableDiff); |
|
| 94 | + } |
|
| 89 | 95 | } else { |
| 90 | 96 | $this->schemaManager->createTable($table); |
| 91 | 97 | } |