-
-
Notifications
You must be signed in to change notification settings - Fork 330
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
"<current()>" causes exception when Faker\Generator instance is passed to NativeLoader constructor #971
Comments
Thanks for the report! I'll look it up ASAP although I must say that I need to take care of a couple of things in AliceDataFixtures and HautelookAliceBundle first when I manage to free some time (this month is quite busy). |
I know you have a lot of work and you do not have to invest your free time/money into this issue :). What I wanted wanted to know is why there is NativeLoader $fakerGenerator argument in constructor and what is its purpose and some general direction how could i help. Thanks |
The There is a |
My initial guess was right. The AliceProvider is not added to Faker\Generator when passing custom instance. Not sure if the Either way, I am ready PR to send with required changes. Thanks! |
Then let's deprecate injecting a custom faker provided since it's more error prone than anything. |
@martingold I was experiencing this exact issue myself when setting a locale and using
worked a treat. Thank you! |
Issue
When I pass my own
Faker\Generator
thenInvalidArgumentException: Unknown formatter "current"
is thrown. My guess is that Alice does not register itscurrent
provider to the passed Generator instance.Why
My motivation to do this is to use
$locale
parameter inFaker\Factory::create()
to set locale as it seems to be the most intuitive way to set locale. It is a handy way instead of extending NativeLoader. But it does not work (locale is still default) but that is subject for another issue.Reproducing issue
I have created minimal repository and you can try it yourself. The issue is demonstrated in these two classes:
MartinGold\AliceIssueRepo\Factory\DefaultFakerAliceFactory::create()
andMartinGold\AliceIssueRepo\Factory\InjectedFakerAliceFactory::create()
My main question is what is the purpose of the NativeLoader $fakerGenerator argument purpose if it breaks the Alice itself and whether it is worth investigating this further and fixing it?
The text was updated successfully, but these errors were encountered: