-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Extra unwanted entities created when testing #29
Comments
Ah, I think I see the issue but want to clarify: When creating the reply from your example above, the proper thread is created and connected to the reply but an "extra" one is created as well (that is not connected to the reply)? If I understand correctly, then the issue is in your protected function getDefaults(): array
{
return [
'body' => self::faker()->paragraph(3, true),
'thread' => ThreadFactory::new(), // NOTE: I removed the ->create()
];
} This way, Does that make sense? |
Thanks - thats exactly what I was doing wrong - had to rewrite my AppFixtures slightly but all now working as I need. Said I was likely just being a moron :) |
Great and thanks for bringing this to light for me! It isn't clear in the docs that |
No worries - glad my stumbling can be of service :) |
Hi All,
Probably being a moron but how do I get my factory to stop creating new entities when passing in the entity I want via the create function.
i.e
$reply = ReplyFactory::new()->create(['thread' => $thread, 'body' => 'Test Body']);
Still creates a new thread despite me passing the specific thread instance to the create function
I presumed (rightly or wrongly) that the thread would only create when newing up a reply if not overridden.
The text was updated successfully, but these errors were encountered: