-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
Hydrator property mapping. #56
Comments
@j I like the feature and it's surely worth giving it a shot, especially when considering that DB fields could be very different from entity field.
The problem I currently encounter is encoding the parameters used to generate the proxy, which is tricky given the small set of characters allowed in class names Some approaches may be to use non-ASCII delimiters such as To make an example: echo urldecode(http_build_query(['map_properties'=>true,'map' => ['fn' => 'firstName', 'ln' => 'lastName']])); Produces
We want
in the class name. Thoughts? |
There's always md5/sha1 hashes :P Other alternatives may be to have a factory instance have a suffix configuration option and users can just create another instance of a factory with a different suffix. |
@j hashes can (rarely) collide - they are not thought for this use case and I really want to avoid them. I think base64 will do the trick :) |
But yes, factories should be immutable |
I think I fixed the problem in #59 - now the factory-specific config can be injected :) |
@j I moved this to Ocramius/GeneratedHydrator#5 |
Hello there!
I have a few features I want to see if you're interested in implementing before I create my own generators.
Basically, I have data I want to hydrate into an object but with different field names.
i.e.)
This shouldn't be too hard to implement i don't think. It'd also be nice to extract it back into the shortened fields. It's just a matter of where to put this configuration or at least make it possible.
I'd like to perhaps add annotations to do the mapping (but I can do that within my application). It'd just be great if it were possible right now. It'd be a simple way to do DTO to domain object mapping and back.
Let me know if you feel this can belong here and I where you feel the configuration should be and I can give you a PR.
The text was updated successfully, but these errors were encountered: