-
-
Notifications
You must be signed in to change notification settings - Fork 77
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 Faker optional()
by default for nullable fields
#536
Comments
Hi @MrYamous This sounds good! I assume you'd want that only for nullable properties? |
Hi, Yes only for nullable properties |
you're absolutely right! are you willing to provide a PR? |
Yes i'll work on it |
I've started looking how to do it but I'm not sure I'm going in the right direction. To start with |
maybe In this class you can know if the field is nullable from doctrine's metadata be careful, you'd need to modify |
When using
make:factory --all-fields
Foundry generate default values for all fields according to their type.WDYT about adding
optional()
method from Faker by default for those values ?For example if i have an entity with a nullable field
phone
currently the default generated is :'phone' => self::faker()->text(),
My proposal would be to have :
'phone' => self::faker()->optional()->text(),
The text was updated successfully, but these errors were encountered: