mirror of
https://github.com/fzaninotto/Faker.git
synced 2025-03-20 23:39:51 +01:00
Some fixes
This commit is contained in:
parent
1a67776e1d
commit
5ae33a24ba
@ -86,16 +86,17 @@ class EntityPopulator
|
||||
/**
|
||||
* Insert one new record using the Entity class.
|
||||
*/
|
||||
public function execute($con, $insertedEntities)
|
||||
public function execute($manager, $insertedEntities)
|
||||
{
|
||||
$obj = new $this->class->getName();
|
||||
$class = $this->class->getName();
|
||||
$obj = new $class;
|
||||
foreach ($this->columnFormatters as $field => $format) {
|
||||
if (null !== $field) {
|
||||
$value = is_callable($format) ? $format($insertedEntities, $obj) : $format;
|
||||
$this->class->reflFields[$field]->setValue($obj, $value);
|
||||
}
|
||||
}
|
||||
$con->persist($obj);
|
||||
$manager->persist($obj);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
@ -50,9 +50,12 @@ class Populator
|
||||
*/
|
||||
public function execute($entityManager = null)
|
||||
{
|
||||
if (null !== $entityManager) {
|
||||
if (null === $entityManager) {
|
||||
$entityManager = $this->manager;
|
||||
}
|
||||
if (null === $entityManager) {
|
||||
throw new \InvalidArgumentException("No entity manager passed to Doctrine Populator.");
|
||||
}
|
||||
|
||||
$insertedEntities = array();
|
||||
foreach ($this->quantities as $class => $number) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user