@@ -66,7 +66,7 @@ |
||
66 | 66 | if ($goDeeper){ |
67 | 67 | $hasGoneDeeper = true; |
68 | 68 | $value = $this->generateRandomObject($depth - 1); |
69 | - }else{ |
|
69 | + } else{ |
|
70 | 70 | $value = $this->randomValue(); |
71 | 71 | } |
72 | 72 | $obj->$propName = $value; |
@@ -58,21 +58,21 @@ |
||
58 | 58 | $obj = new \stdClass(); |
59 | 59 | $nbProps = \random_int(2, 5); |
60 | 60 | $hasGoneDeeper = false; |
61 | - for ($i = 0; $i < $nbProps; $i++){ |
|
61 | + for ($i = 0; $i < $nbProps; $i++) { |
|
62 | 62 | $propName = $this->randomPropName(); |
63 | - $goDeeper = $depth !== 0 && (\random_int(0,10) > 7 || !$hasGoneDeeper); |
|
64 | - if ($goDeeper){ |
|
63 | + $goDeeper = $depth !== 0 && (\random_int(0, 10) > 7 || !$hasGoneDeeper); |
|
64 | + if ($goDeeper) { |
|
65 | 65 | $hasGoneDeeper = true; |
66 | 66 | $value = $this->generateRandomObject($depth - 1); |
67 | - }else{ |
|
67 | + }else { |
|
68 | 68 | $value = $this->randomValue(); |
69 | 69 | } |
70 | 70 | $obj->$propName = $value; |
71 | 71 | } |
72 | 72 | |
73 | - if ($this->toArray){ |
|
73 | + if ($this->toArray) { |
|
74 | 74 | $obj = json_encode($obj, JSON_OBJECT_AS_ARRAY); |
75 | - if (!$obj){ |
|
75 | + if (!$obj) { |
|
76 | 76 | throw new DBFakerException('Could not convert generated object to Json String'); |
77 | 77 | } |
78 | 78 | $obj = json_decode($obj, true); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | class CheckTypeConditionTest extends TestCase |
10 | 10 | { |
11 | - public function testCanApply(){ |
|
11 | + public function testCanApply() { |
|
12 | 12 | $table = new Table("foo"); |
13 | 13 | $column = new Column("bar", Type::getType(Type::DECIMAL)); |
14 | 14 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | ->column("population")->bigInt() |
64 | 64 | ->column("birthrate")->float() |
65 | 65 | ->column("president_id")->references("persons") |
66 | - ->column("population_density")->decimal(10,2) |
|
66 | + ->column("population_density")->decimal(10, 2) |
|
67 | 67 | ->column("summary")->text(); |
68 | 68 | |
69 | 69 | $users->column("country_id")->references("countries"); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | // address.postal_code column is a varchar, so default generated data will be text. Here we want a postal code : |
112 | 112 | $generatorFinderBuilder->addGenerator( |
113 | - new \DBFaker\Generators\Conditions\CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table, \Doctrine\DBAL\Schema\Column $column){ |
|
113 | + new \DBFaker\Generators\Conditions\CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table, \Doctrine\DBAL\Schema\Column $column) { |
|
114 | 114 | return $table->getName() == "address" && $column->getName() == "postal_code"; |
115 | 115 | }), |
116 | 116 | new SimpleGeneratorFactory("postcode") |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | // all columns that end with "_email" or are named exactly "email" should be emails |
120 | 120 | $generatorFinderBuilder->addGenerator( |
121 | - new CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table, \Doctrine\DBAL\Schema\Column $column){ |
|
121 | + new CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table, \Doctrine\DBAL\Schema\Column $column) { |
|
122 | 122 | return preg_match("/([(.*_)|_|]|^)email$/", $column->getName()) === 1; |
123 | 123 | }), |
124 | 124 | new SimpleGeneratorFactory("email") |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $faker->setFakeTableRowNumbers($tableRowNumbers); |
147 | 147 | $faker->fakeDB(); |
148 | 148 | |
149 | - foreach ($tableRowNumbers as $tableName => $expectedCount){ |
|
149 | + foreach ($tableRowNumbers as $tableName => $expectedCount) { |
|
150 | 150 | $count = $conn->fetchColumn('SELECT count(*) from ' . $tableName); |
151 | 151 | $this->assertEquals($expectedCount, $count); |
152 | 152 | } |
@@ -167,7 +167,7 @@ |
||
167 | 167 | else { |
168 | 168 | if (!$column->getNotnull() && $this->nullProbabilityOccured()){ |
169 | 169 | $value = null; |
170 | - }else{ |
|
170 | + } else{ |
|
171 | 171 | $generator = $this->getSimpleColumnGenerator($table, $column); |
172 | 172 | $value = $generator(); |
173 | 173 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function fakeDB() : void |
114 | 114 | { |
115 | - set_time_limit(0);//Import may take a looooooong time :) |
|
115 | + set_time_limit(0); //Import may take a looooooong time :) |
|
116 | 116 | $data = $this->generateFakeData(); |
117 | 117 | $extensionContraints = $this->getExtensionConstraints(); |
118 | 118 | $foreignKeys = $this->dropForeignKeys(); |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | } |
166 | 166 | //Other data will be Faked depending of column's type and attributes. FKs to, but their values wil be overridden. |
167 | 167 | else { |
168 | - if (!$column->getNotnull() && $this->nullProbabilityOccured()){ |
|
168 | + if (!$column->getNotnull() && $this->nullProbabilityOccured()) { |
|
169 | 169 | $value = null; |
170 | - }else{ |
|
170 | + }else { |
|
171 | 171 | $generator = $this->getSimpleColumnGenerator($table, $column); |
172 | 172 | $value = $generator(); |
173 | 173 | } |
@@ -220,14 +220,14 @@ discard block |
||
220 | 220 | private function insertWithoutFksAndUniqueIndexes(array $data): void |
221 | 221 | { |
222 | 222 | $plateform = $this->connection->getDatabasePlatform(); |
223 | - foreach ($data as $tableName => $rows){ |
|
223 | + foreach ($data as $tableName => $rows) { |
|
224 | 224 | $table = $this->schemaManager->listTableDetails($tableName); |
225 | 225 | |
226 | 226 | //initiate column types for insert : only get the first array to retrieve column names |
227 | 227 | $types = []; |
228 | 228 | $first = reset($rows); |
229 | - if ($first){ |
|
230 | - foreach ($first as $columnName => $value){ |
|
229 | + if ($first) { |
|
230 | + foreach ($first as $columnName => $value) { |
|
231 | 231 | /** @var Column $column */ |
232 | 232 | $column = $table->getColumn($columnName); |
233 | 233 | $types[] = $column->getType()->getBindingType(); |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | |
237 | 237 | //insert faked data |
238 | 238 | $cnt = count($rows); |
239 | - foreach ($rows as $index => $row){ |
|
239 | + foreach ($rows as $index => $row) { |
|
240 | 240 | $dbRow = []; |
241 | - foreach ($row as $columnName => $value){ |
|
241 | + foreach ($row as $columnName => $value) { |
|
242 | 242 | $column = $table->getColumn($columnName); |
243 | 243 | $newVal = $column->getType()->convertToDatabaseValue($value, $plateform); |
244 | 244 | $dbRow[$column->getQuotedName($this->connection->getDatabasePlatform())] = $newVal; |
@@ -247,10 +247,10 @@ discard block |
||
247 | 247 | $this->connection->insert($table->getName(), $dbRow, $types); |
248 | 248 | } |
249 | 249 | //if autoincrement, add the new ID to the PKRegistry |
250 | - if ($table->hasPrimaryKey()){ |
|
250 | + if ($table->hasPrimaryKey()) { |
|
251 | 251 | $pkColumnName = $table->getPrimaryKeyColumns()[0]; |
252 | 252 | $pkColumn = $table->getColumn($pkColumnName); |
253 | - if ($pkColumn->getAutoincrement() && $this->schemaHelper->isPrimaryKeyColumn($table, $pkColumn)){ |
|
253 | + if ($pkColumn->getAutoincrement() && $this->schemaHelper->isPrimaryKeyColumn($table, $pkColumn)) { |
|
254 | 254 | $this->getPkRegistry($table)->addValue([$pkColumnName => $this->connection->lastInsertId()]); |
255 | 255 | } |
256 | 256 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public function getPkRegistry(Table $table, bool $isSelfReferencing = false) : PrimaryKeyRegistry |
267 | 267 | { |
268 | - $index = $table->getName().($isSelfReferencing ? 'dbfacker_self_referencing' :''); |
|
268 | + $index = $table->getName() . ($isSelfReferencing ? 'dbfacker_self_referencing' : ''); |
|
269 | 269 | if (!isset($this->primaryKeyRegistries[$index])) { |
270 | 270 | $this->primaryKeyRegistries[$index] = new PrimaryKeyRegistry($this->connection, $table, $this->schemaHelper, $isSelfReferencing); |
271 | 271 | } |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | $this->log->info('Step 2.1 : Drop FKs ...'); |
313 | 313 | $foreignKeys = []; |
314 | 314 | $tables = $this->schemaManager->listTables(); |
315 | - foreach ($tables as $table){ |
|
316 | - foreach ($table->getForeignKeys() as $fk){ |
|
315 | + foreach ($tables as $table) { |
|
316 | + foreach ($table->getForeignKeys() as $fk) { |
|
317 | 317 | $foreignTable = $this->schemaManager->listTableDetails($fk->getForeignTableName()); |
318 | - foreach ($fk->getColumns() as $localColumnName){ |
|
318 | + foreach ($fk->getColumns() as $localColumnName) { |
|
319 | 319 | $localColumn = $table->getColumn($localColumnName); |
320 | 320 | $selfReferencing = $fk->getForeignTableName() === $table->getName(); |
321 | 321 | $fkValueGenerator = new ForeignKeyColumnGenerator($table, $localColumn, $this->getPkRegistry($foreignTable, $selfReferencing), $fk, $this->fakerManagerHelper, $this->schemaHelper); |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | private function restoreForeignKeys($foreignKeys) : void |
336 | 336 | { |
337 | 337 | $this->log->info('Step 4 : restore foreign keys'); |
338 | - foreach ($foreignKeys as $tableName => $fks){ |
|
339 | - foreach ($fks as $fk){ |
|
338 | + foreach ($foreignKeys as $tableName => $fks) { |
|
339 | + foreach ($fks as $fk) { |
|
340 | 340 | $this->schemaManager->createForeignKey($fk, $tableName); |
341 | 341 | } |
342 | 342 | } |
@@ -351,9 +351,9 @@ discard block |
||
351 | 351 | $this->log->info('Step 2.2 : Drop Multiple indexes ...'); |
352 | 352 | $multipleUniqueContraints = []; |
353 | 353 | $tables = $this->schemaManager->listTables(); |
354 | - foreach ($tables as $table){ |
|
355 | - foreach ($table->getIndexes() as $index){ |
|
356 | - if ($index->isUnique() && count($index->getColumns()) > 1){ |
|
354 | + foreach ($tables as $table) { |
|
355 | + foreach ($table->getIndexes() as $index) { |
|
356 | + if ($index->isUnique() && count($index->getColumns()) > 1) { |
|
357 | 357 | $multipleUniqueContraints[$table->getName()][] = $index; |
358 | 358 | $this->schemaManager->dropIndex($index->getQuotedName($this->connection->getDatabasePlatform()), $table->getName()); |
359 | 359 | } |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | private function restoreMultipleUniqueContraints(array $multipleUniqueContraints): void |
369 | 369 | { |
370 | 370 | $this->log->info('Step 5 : restore multiple unique indexes keys'); |
371 | - foreach ($multipleUniqueContraints as $tableName => $indexes){ |
|
372 | - foreach ($indexes as $index){ |
|
371 | + foreach ($multipleUniqueContraints as $tableName => $indexes) { |
|
372 | + foreach ($indexes as $index) { |
|
373 | 373 | $this->schemaManager->createIndex($index, $tableName); |
374 | 374 | } |
375 | 375 | } |
@@ -387,24 +387,24 @@ discard block |
||
387 | 387 | private function updateMultipleUniqueIndexedColumns(array $multipleUniqueContraints, array $handledFKColumns) : array |
388 | 388 | { |
389 | 389 | |
390 | - foreach ($multipleUniqueContraints as $tableName => $indexes){ |
|
390 | + foreach ($multipleUniqueContraints as $tableName => $indexes) { |
|
391 | 391 | $table = $this->schemaManager->listTableDetails($tableName); |
392 | 392 | |
393 | - foreach ($indexes as $index){ |
|
394 | - foreach ($index->getColumns() as $columnName){ |
|
395 | - $fullColumnName = $tableName. '.' .$columnName; |
|
396 | - if (!\in_array($fullColumnName, $handledFKColumns, true)){ |
|
393 | + foreach ($indexes as $index) { |
|
394 | + foreach ($index->getColumns() as $columnName) { |
|
395 | + $fullColumnName = $tableName . '.' . $columnName; |
|
396 | + if (!\in_array($fullColumnName, $handledFKColumns, true)) { |
|
397 | 397 | $handledFKColumns[] = $fullColumnName; |
398 | 398 | } |
399 | 399 | } |
400 | 400 | } |
401 | 401 | |
402 | - $stmt = $this->connection->query('SELECT * FROM ' .$tableName); |
|
403 | - $count = $this->connection->fetchColumn('SELECT count(*) FROM ' .$tableName); |
|
402 | + $stmt = $this->connection->query('SELECT * FROM ' . $tableName); |
|
403 | + $count = $this->connection->fetchColumn('SELECT count(*) FROM ' . $tableName); |
|
404 | 404 | $i = 1; |
405 | 405 | while ($row = $stmt->fetch()) { |
406 | 406 | $newValues = []; |
407 | - foreach ($indexes as $index){ |
|
407 | + foreach ($indexes as $index) { |
|
408 | 408 | /** @var Index $index */ |
409 | 409 | $compoundColumnGenerator = $this->getCompoundColumnGenerator($table, $index, $count); |
410 | 410 | $newValues = array_merge($newValues, $compoundColumnGenerator()); |
@@ -426,23 +426,23 @@ discard block |
||
426 | 426 | */ |
427 | 427 | private function updateRemainingForeignKeys(array $foreignKeys, array $handledFKColumns): void |
428 | 428 | { |
429 | - foreach ($foreignKeys as $tableName => $fks){ |
|
430 | - if (!array_key_exists($tableName, $this->fakeTableRowNumbers)){ |
|
429 | + foreach ($foreignKeys as $tableName => $fks) { |
|
430 | + if (!array_key_exists($tableName, $this->fakeTableRowNumbers)) { |
|
431 | 431 | //only update tables where data has been inserted |
432 | 432 | continue; |
433 | 433 | } |
434 | 434 | |
435 | 435 | $table = $this->schemaManager->listTableDetails($tableName); |
436 | 436 | |
437 | - $stmt = $this->connection->query('SELECT * FROM ' .$tableName); |
|
438 | - $count = $this->connection->fetchColumn("SELECT count(*) FROM ".$tableName); |
|
437 | + $stmt = $this->connection->query('SELECT * FROM ' . $tableName); |
|
438 | + $count = $this->connection->fetchColumn("SELECT count(*) FROM " . $tableName); |
|
439 | 439 | $i = 1; |
440 | 440 | while ($row = $stmt->fetch()) { |
441 | 441 | $newValues = []; |
442 | 442 | foreach ($fks as $fk) { |
443 | 443 | $localColumns = $fk->getLocalColumns(); |
444 | 444 | foreach ($localColumns as $index => $localColumn) { |
445 | - if (\in_array($tableName . '.' . $localColumn, $handledFKColumns)){ |
|
445 | + if (\in_array($tableName . '.' . $localColumn, $handledFKColumns)) { |
|
446 | 446 | continue; |
447 | 447 | } |
448 | 448 | $column = $table->getColumn($localColumn); |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | } |
452 | 452 | } |
453 | 453 | $row = $this->stripUnselectableColumns($table, $row); |
454 | - if (count($newValues) && $this->connection->update($tableName, $newValues, $row) === 0){ |
|
455 | - throw new DBFakerException("Row has not been updated $tableName - ". var_export($newValues,true) . ' - ' . var_export($row, true)); |
|
454 | + if (count($newValues) && $this->connection->update($tableName, $newValues, $row) === 0) { |
|
455 | + throw new DBFakerException("Row has not been updated $tableName - " . var_export($newValues, true) . ' - ' . var_export($row, true)); |
|
456 | 456 | }; |
457 | 457 | $this->log->info("Step 3.3 : updated $i of $count for $tableName"); |
458 | 458 | $i++; |
@@ -471,10 +471,10 @@ discard block |
||
471 | 471 | private function updateExtensionContraints(array $extensionConstraints) : array |
472 | 472 | { |
473 | 473 | $handledFKColumns = []; |
474 | - foreach ($extensionConstraints as $fk){ |
|
474 | + foreach ($extensionConstraints as $fk) { |
|
475 | 475 | $localTableName = $fk->getLocalTable()->getQuotedName($this->connection->getDatabasePlatform()); |
476 | 476 | $stmt = $this->connection->query('SELECT * FROM ' . $localTableName); |
477 | - $count = $this->connection->fetchColumn('SELECT count(*) FROM ' .$localTableName); |
|
477 | + $count = $this->connection->fetchColumn('SELECT count(*) FROM ' . $localTableName); |
|
478 | 478 | $i = 1; |
479 | 479 | while ($row = $stmt->fetch()) { |
480 | 480 | $newValues = []; |
@@ -486,8 +486,8 @@ discard block |
||
486 | 486 | $newValues[$localColumn] = $fkValueGenerator(); |
487 | 487 | } |
488 | 488 | $row = $this->stripUnselectableColumns($fk->getLocalTable(), $row); |
489 | - if ($this->connection->update($localTableName, $newValues, $row) === 0){ |
|
490 | - throw new DBFakerException("Row has not been updated $localTableName - ". var_export($newValues,true) . ' - ' . var_export($row, true)); |
|
489 | + if ($this->connection->update($localTableName, $newValues, $row) === 0) { |
|
490 | + throw new DBFakerException("Row has not been updated $localTableName - " . var_export($newValues, true) . ' - ' . var_export($row, true)); |
|
491 | 491 | }; |
492 | 492 | $this->log->info("Updated $i of $count for $localTableName"); |
493 | 493 | $i++; |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | */ |
507 | 507 | private function getCompoundColumnGenerator(Table $table, Index $index, int $count): CompoundColumnGenerator |
508 | 508 | { |
509 | - if (!isset($this->compoundColumnGenerators[$table->getName() . "." . $index->getName()])){ |
|
509 | + if (!isset($this->compoundColumnGenerators[$table->getName() . "." . $index->getName()])) { |
|
510 | 510 | $compoundGenerator = new CompoundColumnGenerator($table, $index, $this->schemaHelper, $this, $this->schemaManager, $this->fakerManagerHelper, $count); |
511 | 511 | $this->compoundColumnGenerators[$table->getName() . '.' . $index->getName()] = $compoundGenerator; |
512 | 512 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | return array_filter($row, function(string $columnName) use ($table) { |
548 | 548 | return !\in_array($table->getColumn($columnName)->getType()->getName(), [ |
549 | 549 | Type::BINARY, Type::JSON, Type::JSON_ARRAY, Type::SIMPLE_ARRAY, Type::TARRAY, Type::BLOB, Type::JSON, Type::OBJECT |
550 | - ],true); |
|
550 | + ], true); |
|
551 | 551 | }, ARRAY_FILTER_USE_KEY); |
552 | 552 | } |
553 | 553 | |
@@ -560,9 +560,9 @@ discard block |
||
560 | 560 | $this->log->info('Step 2.1 : store extension constraints ...'); |
561 | 561 | $extensionConstraints = []; |
562 | 562 | $tables = $this->schemaManager->listTables(); |
563 | - foreach ($tables as $table){ |
|
564 | - foreach ($table->getForeignKeys() as $fk){ |
|
565 | - if ($this->schemaHelper->isExtendingKey($fk)){ |
|
563 | + foreach ($tables as $table) { |
|
564 | + foreach ($table->getForeignKeys() as $fk) { |
|
565 | + if ($this->schemaHelper->isExtendingKey($fk)) { |
|
566 | 566 | $extensionConstraints[] = $fk; |
567 | 567 | } |
568 | 568 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function generateRandomValue(Column $column) |
54 | 54 | { |
55 | - switch ($column->getType()->getName()){ |
|
55 | + switch ($column->getType()->getName()) { |
|
56 | 56 | case Type::BIGINT: |
57 | 57 | return $this->bigRandomNumber(); |
58 | 58 | case Type::INTEGER: |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | case Type::FLOAT: |
63 | 63 | return $this->faker->randomFloat(10, $this->min, $this->max); |
64 | 64 | default: |
65 | - throw new UnsupportedDataTypeException("Cannot generate numeric value for Type : '".$column->getType()->getName()."'"); |
|
65 | + throw new UnsupportedDataTypeException("Cannot generate numeric value for Type : '" . $column->getType()->getName() . "'"); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | private function bigRandomNumber() : string |
73 | 73 | { |
74 | - $difference = bcadd(bcsub($this->max,$this->min),"1"); |
|
74 | + $difference = bcadd(bcsub($this->max, $this->min), "1"); |
|
75 | 75 | $rand_percent = bcdiv((string) mt_rand(), (string) mt_getrandmax(), 8); // 0 - 1.0 |
76 | 76 | return bcadd($this->min, bcmul($difference, $rand_percent, 8), 0); |
77 | 77 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | public function __construct(string $fakerProperty, bool $generateUniqueValues = false) |
27 | 27 | { |
28 | 28 | $this->faker = Factory::create(); |
29 | - if ($generateUniqueValues){ |
|
29 | + if ($generateUniqueValues) { |
|
30 | 30 | $this->faker->unique(); |
31 | 31 | } |
32 | 32 | $this->fakerProperty = $fakerProperty; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | public function __construct(string $globExpression) |
20 | 20 | { |
21 | - $this->globExpression= $globExpression; |
|
21 | + $this->globExpression = $globExpression; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function __construct(Column $column, bool $generateUniqueValues = false) |
28 | 28 | { |
29 | 29 | $this->faker = Factory::create(); |
30 | - if ($generateUniqueValues){ |
|
30 | + if ($generateUniqueValues) { |
|
31 | 31 | $this->faker->unique(); |
32 | 32 | } |
33 | 33 | $this->column = $column; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @throws \Doctrine\DBAL\DBALException |
46 | 46 | * @throws \Doctrine\DBAL\Schema\SchemaException |
47 | 47 | */ |
48 | - public function __construct(Table $table, Column $column, PrimaryKeyRegistry $foreignPkRegistry, ForeignKeyConstraint $fk, DBFakerSchemaManager $schemaManager, SchemaHelper $schemaHelper) |
|
48 | + public function __construct(Table $table, Column $column, PrimaryKeyRegistry $foreignPkRegistry, ForeignKeyConstraint $fk, DBFakerSchemaManager $schemaManager, SchemaHelper $schemaHelper) |
|
49 | 49 | { |
50 | 50 | $this->foreignColumn = $schemaManager->getForeignColumn($table, $column); |
51 | 51 | $this->foreignPkRegistry = $foreignPkRegistry; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | $randomPk = $this->foreignPkRegistry->loadValuesFromTable()->getRandomValue($this->alreadyGeneratedValues); |
63 | 63 | $value = $randomPk[$this->foreignColumn->getName()]; |
64 | - if ($this->generateUniqueValues){ |
|
64 | + if ($this->generateUniqueValues) { |
|
65 | 65 | $this->alreadyGeneratedValues[] = $randomPk; |
66 | 66 | } |
67 | 67 | return $value; |