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

Hydration Strategies #434

Open
nagibyro opened this issue Oct 6, 2016 · 1 comment
Open

Hydration Strategies #434

nagibyro opened this issue Oct 6, 2016 · 1 comment

Comments

@nagibyro
Copy link

nagibyro commented Oct 6, 2016

Looking at the attribute generate method it looks like there is only support for setter injection. It would be nice to be able to customize hydration for different types of objects -- such as immutable objects whose attributes are only set through the constructor. Perhaps creating a hydrationStrategyInterface or something of that nature. This would allow others to create strategies that work better with their objects such as using reflection to set attributes instead.

@floriandammeyer
Copy link

Sadly this idea has not received any feedback yet. I would really appreciate being able to change the way attributes are set on a new instance. We employ domain-driven design and instead of implementing a bunch of otherwise meaningless setters, we use more semantically named methods to update an instance's attributes. And for value objects, which are immutable, we don't implement any setters at all, so FactoryMuffin would have to use a reflection based strategy or the constructor to set attributes.

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

No branches or pull requests

2 participants