Skip to content

Loading…

DDC-161: Custom Hydrator #2249

Closed
doctrinebot opened this Issue · 8 comments

2 participants

@doctrinebot

Jira issue originally created by user marijn:

I was wondering if it would be possible to create custom hydrators for Doctrine 2.0. If I have a look at the EntityManager#getHydrator() method it seems not. Or should I subclass the EntityManager and override the getHydrator() method?

@doctrinebot

Comment created by @guilhermeblanco:

Maybe we should just take the approach we did for registering types and reuse same idea in hydrators too.

Of course it'll require us to write an Interface so people can at least have an idea of what's needed and make the AbstractHydrator to implement it.

I'm +1 to include this support, since we already have it in earlier 1.X and people can surely uses it if they're not affordable with our nice hydrators.

Cheers,

@doctrinebot

Comment created by @jwage:

I'd like to see this in 2.0 as well too.

@doctrinebot

Comment created by romanb:

Scheduled for the first beta. I already have an idea on how to do this. Should be fairly easy.

@doctrinebot

Comment created by romanb:

Jon, would you want to give this a try? Custom hydrators should be registered as closures I think, since they are instantiated on demand.

@doctrinebot

Comment created by romanb:

Just another thought on the issue. Maybe it is enough to set the hydrator on a Query to use. That way we don't need additional configuration cruft.

So instead of being able to register custom "hydration modes", you can simply set a custom "hydrator" on a specific query.

@doctrinebot

Comment created by marijn:

I agree with Roman. As an added bonus: that's what people are used to from Doctrine 1

@doctrinebot

Comment created by @jwage:

How do you want to handle that roman? Another setting to set the custom query? or just allow a default hydrator that expects a string className in the EntityManager#newHydrator() method? or what were you thinking?

@doctrinebot

Issue was closed with resolution "Fixed"

@jwage jwage was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.0-BETA2 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.