Open CJDennis opened 4 years ago
I don't know why exactly but wrapping the $em->getRepository(...)
call in a closure seems to fix this issue for me, e.g.:
'accountRole' => function() use ($em) {
return $em->getRepository(AccountRole::class)->findOneBy(['name' => 'ROLE_PHARMACIST']);
}
I'm guessing the closure is executed at a different point in the execution flow.
@Liiva Thank you! You saved me so much time. :) I've been struggling with this for over 2 hours.
@DavertMik Maybe it is good idea to add this to docs?
What are you trying to achieve?
According to https://codeception.com/docs/modules/DataFactory.html you can create a new entity which is related to an existing entity. I can't get this functionality to work.
What do you get instead?
Details