This repository has been archived by the owner on Dec 11, 2020. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I made 2 changes to facilitate my use of Faker against Doctrine entities.
First, to track down formatter errors, I re-throw the InvalidArgumentException with the specific class name and field name that failed. This helped me track down several issues I had tracking down decimal fields that were bigger than mt_getrandmax.
Second, Doctrine entities usually have setters for their properties, and those setters can have their own behaviors (regenerating slugs on setting a title, passing relationship assignment between owner and inversion, etc.). I therefore thought trying to use the setter to assign a value before falling back on reflection might improve the resulting object mockup. The reflection strategy is useful for hydration, where the data has already been established and is merely being re-loaded into an object, not for creating new data, as the EntityPopulator is trying to do.