-
Notifications
You must be signed in to change notification settings - Fork 133
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
[Docs] Specify how to link a created entity to another #139
Comments
Hey @johannchopin, did you find how to resolve this issue? |
Sadly no @joaomantovani 😓 I hope to hear soon from the core maintainers that seems a bit shy 😅 |
I'm not 100% on your use case and I haven't tested this, but hopefully points you in the right direction. Use the ORM connection in the Seed file to find Customers you want the Event to have, then pass that through to the Factory:
Then add that to the Column you require:
The problem I am currently facing is that the execution of the Seeders is done in alphabetical order. So In your case you would need to setup the relationship in Event rather than Customer. Hope this helps. |
@michaelpwilson How you resolve order runing for each seeder ? I want my seeder file run from top to end. |
@michaelpwilson @phamhuyhoang95 You can easily modify the seeder order by adding a number before the filename like:
|
I have 2 factories for 2 entities
Customer
andEvent
:Entitites
Factories
As you can see a
Customer
can have multipleEvent
s and differentCustomer
s can participate to the sameEvent
. So my goal for the seeding part is to create 10 differentEvent
s and then create 100Customer
s that participate at some of theseEvent
s. So I created 2 seeding files:However that only create some entries but doesn't link them together.
I know that I could use the
Event
's factory inside of the theCustomer
's one:But that will just create 10 different
Event
s for eachCustomer
.So how to seed my
Customer
s in a way that they are linked to someEvent
s created during theseed:run
command? I hope there is a way to do that and if yes I will be pleased to add it to the README documentation section.The text was updated successfully, but these errors were encountered: