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

Doctrine orm polish #475

Closed

Conversation

lexicalbits
Copy link
Contributor

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.

@fzaninotto
Copy link
Owner

any opinion on this one, @beberlei?

By the way tests fail.

@fzaninotto
Copy link
Owner

Tests still fail.

@fzaninotto
Copy link
Owner

@cbourgois any feedback on this one?

@lexicalbits
Copy link
Contributor Author

@fzaninotto I'm happy to take a more detailed pass at this if you think my position makes any sense. If my premise doesn't fit what you're trying to accomplish, feel free to ditch the PR.

@fzaninotto
Copy link
Owner

@lexicalbits My problem is that I'm unable to review your code, and I'd like another Doctrine user to double check.

@cbourgois
Copy link
Contributor

It seems ok.

Tests still fails.
@lexicalbits , read https://travis-ci.org/fzaninotto/Faker/jobs/43672548 for help

@fzaninotto
Copy link
Owner

Merged via the command line. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants