Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Improvement maybe: Fill any object you want. #2041

Open
didslm opened this issue Aug 13, 2020 · 0 comments
Open

Improvement maybe: Fill any object you want. #2041

didslm opened this issue Aug 13, 2020 · 0 comments

Comments

@didslm
Copy link

didslm commented Aug 13, 2020

Summary

I already did something in my project where it uses faker to fill objects and tries to guess the format if not it goes by the input type (int|string|bool) it works even with custom object.
There is already something inside for Doctrine entities but I couldn't find it for objects with some setters.
Btw this works only if the object has setters.

Self-enclosed code snippet for reproduction

To use it you just provide the object and it will fill it.
Example

$faker->fillObject($someObject, FILL_OPTIONAL_PARAMETERS);
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant