diff --git a/.gitignore b/.gitignore index 42390b7..5219135 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /composer.phar /vendor/ /generated_data/ +.php_cs.cache diff --git a/src/Generator/EntityGenerator.php b/src/Generator/EntityGenerator.php index 817ec2a..2ae561d 100644 --- a/src/Generator/EntityGenerator.php +++ b/src/Generator/EntityGenerator.php @@ -859,13 +859,9 @@ private function getRandomRelationId($relationName, $relationConditions, $entity // a random relation value $randomRelation = $this->relations[$relationName][array_rand($this->relations[$relationName])]; if ($try >= $maxRetry) { - throw new RuntimeException( - 'A '. $relationName . ' relation can\'t be found for entity ' . $entityName - . ' with these conditions : ' . http_build_query($relationConditions,'',', ') - . ' try to adapt config.yml or entity files in src/Model' - ); + throw new RuntimeException('A ' . $relationName . ' relation can\'t be found for entity ' . $entityName . ' with these conditions : ' . http_build_query($relationConditions, '', ', ') . ' try to adapt config.yml or entity files in src/Model'); } - $try++; + ++$try; } while (!$this->isMatchingConditions($relationConditions, $randomRelation)); return (string) ($randomRelation['id']);