1
0
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:
Benjamin Eberlei 2012-11-07 13:43:31 +01:00
parent ce23e17807
commit 9010313f9e

View File

@ -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;
}
}
}