-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add documentation to use Zenstruck Foundry instead of Alice #1699
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
distribution/testing.md
Outdated
```console | ||
docker compose exec php \ | ||
composer require --dev maker | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would split the two calls to maker in two separate commands for clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYM
Do you mean these calls?
bin/console make:factory 'App\Entity\Book' &&
bin/console make:factory 'App\Entity\Review'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just two lines:
$ bin/console make:factory 'App\Entity\Book'
$ bin/console make:factory 'App\Entity\Review'
'book' => BookFactory::randomOrCreate(), | ||
'publicationDate' => \DateTimeImmutable::createFromMutable(self::faker()->dateTime()), | ||
'rating' => self::faker()->numberBetween(0, 5), | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
Can't we keep Alice too? |
@alanpoulain we could keep Alice's documentation in another file, but we should make it crystal clear that we recommend Foundry, as Symfony. |
distribution/testing.md
Outdated
```console | ||
docker compose exec php \ | ||
composer require --dev maker | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just two lines:
$ bin/console make:factory 'App\Entity\Book'
$ bin/console make:factory 'App\Entity\Review'
distribution/testing.md
Outdated
``` | ||
|
||
Thanks to Symfony Flex, Alice (and [AliceBundle](https://github.com/theofidry/AliceBundle)) are ready to use! | ||
Place your data fixtures files in a directory named `fixtures/`. | ||
And, install [Symfony/MakerBundle](https://github.com/symfony/maker-bundle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MakerBundle is installed with the distribution.
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
@dunglas I did the suggested changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Here are some minor comments.
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr> Co-authored-by: Kevin Bond <kevinbond@gmail.com>
return [ | ||
'author' => self::faker()->name(), | ||
'body' => self::faker()->text(), | ||
'book' => lazy(fn() => BookFactory::randomOrCreate()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kbond Thank you for your answer, I use your lazy function to create exactly 100 books first and create 30 reviews with random books from the database.
I was not aware of this lazy function or just read too fast this part of the documentation, that's very interesting, thx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But indeed, I could also do that in the DefaultReviewsStory:
ReviewFactory::new()
->withAttributes(['book' => BookFactory::randomOrCreate(),
->many(200)
->create()
;
Thank you very much! |
No description provided.