DDC-161: Custom Hydrator #199

Closed
opened 2026-01-22 12:30:22 +01:00 by admin · 8 comments
Owner

Originally created by @doctrinebot on GitHub (Nov 19, 2009).

Originally assigned to: @jwage on GitHub.

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?

Originally created by @doctrinebot on GitHub (Nov 19, 2009). Originally assigned to: @jwage on GitHub. 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?
admin added the New Feature label 2026-01-22 12:30:22 +01:00
admin closed this issue 2026-01-22 12:30:22 +01:00
Author
Owner

@doctrinebot commented on GitHub (Nov 19, 2009):

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 commented on GitHub (Nov 19, 2009): 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,
Author
Owner

@doctrinebot commented on GitHub (Nov 19, 2009):

Comment created by @jwage:

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

@doctrinebot commented on GitHub (Nov 19, 2009): Comment created by @jwage: I'd like to see this in 2.0 as well too.
Author
Owner

@doctrinebot commented on GitHub (Nov 19, 2009):

Comment created by romanb:

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

@doctrinebot commented on GitHub (Nov 19, 2009): Comment created by romanb: Scheduled for the first beta. I already have an idea on how to do this. Should be fairly easy.
Author
Owner

@doctrinebot commented on GitHub (May 19, 2010):

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 commented on GitHub (May 19, 2010): 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.
Author
Owner

@doctrinebot commented on GitHub (May 19, 2010):

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 commented on GitHub (May 19, 2010): 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.
Author
Owner

@doctrinebot commented on GitHub (May 19, 2010):

Comment created by marijn:

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

@doctrinebot commented on GitHub (May 19, 2010): Comment created by marijn: I agree with Roman. As an added bonus: that's what people are used to from Doctrine 1
Author
Owner

@doctrinebot commented on GitHub (May 20, 2010):

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 commented on GitHub (May 20, 2010): 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?
Author
Owner

@doctrinebot commented on GitHub (Jun 2, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Jun 2, 2010): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#199