-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: infinite loop when 2 factories refer to each other in their default()
methods
#724
Comments
Ok, thanks for the reproducer, I'll check this when I got some time |
@simondaigre, 404 when accessing your reproducer. Maybe not public? |
You're right, I just made it public. |
hi @simondaigre the problem is not a "complex schema" or a lot of dependencies. final class AgencyFactory extends PersistentProxyObjectFactory
{
protected function defaults(): array
{
return [
'agencyImages' => AgencyImageFactory::new()->many(self::faker()->randomDigitNotNull()),
];
}
}
final class AgencyImageFactory extends PersistentProxyObjectFactory
{
protected function defaults(): array
{
return [
'agency' => AgencyFactory::new(),
];
}
} when I do
As stated in the docs, you should avoid adding That being said, I think we should implement some kind of circular dependency guard. I'm also wondering how Foundry 1 did handle this 🤔 |
default()
methods
@nikophil thanks for looking at this ! I can handle this but it could be simpler if Foundry handle this. Sometime I just need to instanciate some I tried to remove |
I'm not sure we'll actively support the fact to add
you can either add |
fun fact: #742 seems to also fix the infinite loop problem, and I absolutely don't know why 😅 by the way, I tried to reproduce the problem in foundry's test suite, and I did not manage to do it, even without the fix 🤷 |
I just checked and I confirm #742 fixes all my issues. All my tests are OK, like Foundry 1 🎉 |
this will be released soon 😉 |
Since 2.x on one of my projects, I have a segfault when I try to create a complex
PersistentProxyObject
with a lot of dependencies.On 1.x no issues at all.
I dig a lot to find what's wrong but I have no clue.
Reproducer is here : https://github.com/simondaigre/foundry-repro/tree/repro-segfault
The text was updated successfully, but these errors were encountered: