mirror of
https://github.com/fzaninotto/Faker.git
synced 2025-03-24 01:09:50 +01:00
Bugfix: Use ClassMetadata#newInstance()
This commit is contained in:
parent
ce23e17807
commit
9010313f9e
@ -88,17 +88,18 @@ class EntityPopulator
|
||||
*/
|
||||
public function execute($manager, $insertedEntities)
|
||||
{
|
||||
$class = $this->class->getName();
|
||||
$obj = new $class;
|
||||
$obj = $this->class->newInstance();
|
||||
|
||||
foreach ($this->columnFormatters as $field => $format) {
|
||||
if (null !== $format) {
|
||||
$value = is_callable($format) ? $format($insertedEntities, $obj) : $format;
|
||||
$this->class->reflFields[$field]->setValue($obj, $value);
|
||||
}
|
||||
}
|
||||
|
||||
$manager->persist($obj);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user