- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 331
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
Cannot get generator for custom faker provider #415
Comments
Urg indeed. I remember there was this discussion about it. A workaround I've used in HautelookAliceBundle is actually having two Faker generators: I just have to make sure they are initialized with the same value which is not very hard. Another thing is: check you faker provider again. Providers have A LOT of static calls, it's very rare to actually need to inject a faker instance. To my knowledge, there has been only 3 complains about it: me and h4cc in the issue I've linked, because we were making a bundle and that looked like a design flaw and causing problems for registering custom providers, and you. So it's worth double checking before making any actual change to v2. That said, it's a flaw that will be fixed in v3 for sure. |
Well, in my instance I want to use an instance so that I can inject a media manager from which I can extract file names. I guess I could use static methods to randomly select from a pre-defined path (making it a generic file provider). |
That said, I am not sure how I can use static methods to provide data? Are you suggesting to use |
No I meant to inject your provider in the loader. I'm letting you tinkering with it, if opening up a function fix you're problem it's fine by me as long as it doesn't introduce a BC and is not overly hacky. I just want to avoid to do that unless necessary :) |
Ah I see. ok, will give that a shot, maybe I don't need to inject the generator. |
Any luck @dantleech? |
Havn't had an opportunity to tackle this yet, but a project I am working On Wed, Jul 06, 2016 at 02:48:11AM -0700, Théo FIDRY wrote:
|
Closing this now. If you still feel the need for it, feel free to open a new issue for it. |
I have created a custom provider, which needs a Faker Generator instance in the constructor.
The documentation says that this can be retrieved from the
Nelmio\Alice\Instances\Processor\Methods\Faker
class, however thegetGenerator
method is private.The text was updated successfully, but these errors were encountered: