You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.
greeting
when I have to make fixtures with relationships, the populator tells me that my entities are not persisted, so by searching in the Faker\ORM\Doctrine\Populator class, I found that there were orm->clear(), it's fine but it makes disappear the entities I join to my relationships so I'm obliged to comment on the clear() so that my fixtures work with relationships.
Do you know if there is a more conventional practice to achieve this?
Thanks for your work anyway
`public function execute($entityManager = null)
{
if (null === $entityManager) {
$entityManager = $this->manager;
}
if (null === $entityManager) {
throw new \InvalidArgumentException("No entity manager passed to Doctrine Populator.");
}
$insertedEntities = [];
foreach ($this->quantities as $class => $number) {
$generateId = $this->generateId[$class];
for ($i = 0; $i < $number; $i++) {
$insertedEntities[$class][] = $this->entities[$class]->execute(
$entityManager,
$insertedEntities,
$generateId
);
if (count($insertedEntities) % $this->batchSize === 0) {
$entityManager->flush();
// $entityManager->clear($class);
}
}
$entityManager->flush();
// $entityManager->clear($class);
}
return $insertedEntities;
}`
The text was updated successfully, but these errors were encountered:
greeting
when I have to make fixtures with relationships, the populator tells me that my entities are not persisted, so by searching in the
Faker\ORM\Doctrine\Populator
class, I found that there were orm->clear(), it's fine but it makes disappear the entities I join to my relationships so I'm obliged to comment on the clear() so that my fixtures work with relationships.Do you know if there is a more conventional practice to achieve this?
Thanks for your work anyway
The text was updated successfully, but these errors were encountered: