Git Product home page Git Product logo

Comments (6)

nikophil avatar nikophil commented on July 23, 2024

Hello,

for your first question, I think you should do this way:

    DirectoryFactory::createMany(
           3,
           [
               'users' => UserFactory::new([ 'sharingZones' => [ $theOneIWant ] ])->random(3),   
           ]
       );

For the second question, it is currently not possible to parametrize stories.
This would be a nice addition, but which would come with some complexity because stories are only loaded once, even if you call it twice

from foundry.

Zer0NimO-web avatar Zer0NimO-web commented on July 23, 2024

Thank you very much. For the first question i'm afraid it won't work since i don't want to create new users, i want to get users already persisted which are linked with a specific sharingZone.

It's clear for the second case. Thanks a lot.

from foundry.

nikophil avatar nikophil commented on July 23, 2024

oups, you're right 😅

what about randomSet()?

from foundry.

Zer0NimO-web avatar Zer0NimO-web commented on July 23, 2024

It could do the job but still i don't know how to write the condition. I don't even know if it is possible to do something like :

UserFactory::randomSet(4, ['SharingZones' => /* ... is linked to $specificSharingZone ... */]);

from foundry.

nikophil avatar nikophil commented on July 23, 2024

sorry, I was not very helpful on this one 😅

I was thinking at first you had a ManyToOne between User and SharingZones. I think you cannot do it for *ToMany 🤷‍♂️

from foundry.

Zer0NimO-web avatar Zer0NimO-web commented on July 23, 2024

No problem, you helped me a lot!

from foundry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.