Skip to content
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

Automatic Entity field resolving #11

Open
panunu opened this issue Aug 28, 2013 · 3 comments
Open

Automatic Entity field resolving #11

panunu opened this issue Aug 28, 2013 · 3 comments

Comments

@panunu
Copy link
Member

panunu commented Aug 28, 2013

The following demonstrates what I mean with automatic field resolving:

$this->factory
    ->define('Entity')
    ->resolve();

And that would be all you need. Of course you would have the option to override the fields that you specifically want to define.

How?

One could read and resolve the fields from Doctrine mapping annotations.

Downsides/blockers/to be resolved

  • Fixtures would be even more coupled to Doctrine
  • How to automatically generate some content to fields which have complicated validation rules?
@mpartel
Copy link
Member

mpartel commented Aug 29, 2013

I guess the default values would be something like "example_username_%d".

One could also add an annotation like `@example "My Example Value %d". Then the example would be close to the validation annotations.

Actually, it looks like xi-fixtures could be made entirely annotation-driven. Not sure if we want to, since code is more flexible than annotations.

@panunu
Copy link
Member Author

panunu commented Aug 29, 2013

I would not want to mix test and production code. Therefore I think annotations (on the actual Entity) are out of the question.

@mpartel
Copy link
Member

mpartel commented Aug 29, 2013

Hmm, I don't see the problem. Annotations are effectively just comments, and these could even be informative ones. An analogy could be made to types.

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

No branches or pull requests

2 participants