mirror of
https://github.com/fzaninotto/Faker.git
synced 2025-03-23 16:59:53 +01:00
Merge pull request #69 from beberlei/BugfixDoctrineAssociation
Bugfix: Doctrine EntityPopulator
This commit is contained in:
commit
8e13625ac4
@ -73,9 +73,10 @@ class EntityPopulator
|
||||
}
|
||||
|
||||
foreach ($this->class->getAssociationNames() AS $assocName) {
|
||||
if (!$this->class->isIdentifier($assocName) || !$this->class->isCollectionValuedAssociation($assocName)) {
|
||||
if ($this->class->isCollectionValuedAssociation($assocName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$relatedClass = $this->class->getAssociationTargetClass($assocName);
|
||||
$formatters[$assocName] = function($inserted) use($relatedClass) { return isset($inserted[$relatedClass]) ? $inserted[$relatedClass][mt_rand(0, count($inserted[$relatedClass]) - 1)] : null; };
|
||||
}
|
||||
@ -101,4 +102,4 @@ class EntityPopulator
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user