@@ -16,7 +16,7 @@ |
||
| 16 | 16 | $container->setParameter('rapido.table_name_prefix', $config['table_name_prefix']); |
| 17 | 17 | $container->setParameter('rapido.id_column_name', $config['id_column_name']); |
| 18 | 18 | |
| 19 | - $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 19 | + $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 20 | 20 | $loader->load('services.xml'); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -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; |
@@ -13,6 +13,6 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function generate($id) |
| 15 | 15 | { |
| 16 | - return $this->prefix . (string) $id; |
|
| 16 | + return $this->prefix.(string) $id; |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -17,8 +17,7 @@ discard block |
||
| 17 | 17 | private $idColumnName; |
| 18 | 18 | private $dbalTypeMapper; |
| 19 | 19 | |
| 20 | - public function __construct |
|
| 21 | - ( |
|
| 20 | + public function __construct( |
|
| 22 | 21 | Connection $connection, |
| 23 | 22 | SchemaSynchronizer $tableGenerator, |
| 24 | 23 | NameGenerator $tableNameGenerator, |
@@ -43,7 +42,7 @@ discard block |
||
| 43 | 42 | $tableName = $this->tableNameGenerator->generate($metadata->getName()); |
| 44 | 43 | $record = $metadata->createRecord($recordData); |
| 45 | 44 | |
| 46 | - $types = array_map(function (ReadModelField $field) { |
|
| 45 | + $types = array_map(function(ReadModelField $field) { |
|
| 47 | 46 | return $this->dbalTypeMapper->mapReadModelToDbalType($field->getDataType()); |
| 48 | 47 | }, $metadata->getFields()); |
| 49 | 48 | |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | private $idColumnName; |
| 17 | 17 | private $columnFactory; |
| 18 | 18 | |
| 19 | - public function __construct |
|
| 20 | - ( |
|
| 19 | + public function __construct( |
|
| 21 | 20 | AbstractSchemaManager $schemaManager, |
| 22 | 21 | Comparator $schemaComparator, |
| 23 | 22 | NameGenerator $tableNameGenerator, |
@@ -49,13 +49,15 @@ |
||
| 49 | 49 | function(Table $existingTable) use ($targetTable) { return $targetTable->getName() == $existingTable->getName(); } |
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | - if (count($existingTables) > 1) |
|
| 53 | - throw new \UnexpectedValueException(sprintf("Multiple tables with the name '%s' exist.", $targetTable->getName())); |
|
| 52 | + if (count($existingTables) > 1) { |
|
| 53 | + throw new \UnexpectedValueException(sprintf("Multiple tables with the name '%s' exist.", $targetTable->getName())); |
|
| 54 | + } |
|
| 54 | 55 | |
| 55 | 56 | if (count($existingTables) == 1) { |
| 56 | 57 | $tableDiff = $this->schemaComparator->diffTable(current($existingTables), $targetTable); |
| 57 | - if ($tableDiff) |
|
| 58 | - $this->schemaManager->alterTable($tableDiff); |
|
| 58 | + if ($tableDiff) { |
|
| 59 | + $this->schemaManager->alterTable($tableDiff); |
|
| 60 | + } |
|
| 59 | 61 | } else { |
| 60 | 62 | $this->schemaManager->createTable($targetTable); |
| 61 | 63 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!($loader = include __DIR__ . '/../vendor/autoload.php')) { |
|
| 3 | +if (!($loader = include __DIR__.'/../vendor/autoload.php')) { |
|
| 4 | 4 | die(<<<EOT |
| 5 | 5 | You need to install the project dependencies using Composer: |
| 6 | 6 | $ wget http://getcomposer.org/composer.phar |
@@ -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']); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | public function registerContainerConfiguration(LoaderInterface $loader) |
| 17 | 17 | { |
| 18 | - new \PDO('sqlite:' . __DIR__ . '/sqlite.db'); |
|
| 19 | - $loader->load(__DIR__ . '/config.yml'); |
|
| 18 | + new \PDO('sqlite:'.__DIR__.'/sqlite.db'); |
|
| 19 | + $loader->load(__DIR__.'/config.yml'); |
|
| 20 | 20 | } |
| 21 | 21 | } |