Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0-BETA2
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      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?

        Activity

        Hide
        Guilherme Blanco added a comment -

        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,

        Show
        Guilherme Blanco added a comment - 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,
        Hide
        Jonathan H. Wage added a comment -

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

        Show
        Jonathan H. Wage added a comment - I'd like to see this in 2.0 as well too.
        Hide
        Roman S. Borschel added a comment -

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

        Show
        Roman S. Borschel added a comment - Scheduled for the first beta. I already have an idea on how to do this. Should be fairly easy.
        Hide
        Roman S. Borschel added a comment -

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

        Show
        Roman S. Borschel added a comment - Jon, would you want to give this a try? Custom hydrators should be registered as closures I think, since they are instantiated on demand.
        Hide
        Roman S. Borschel added a comment -

        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.

        Show
        Roman S. Borschel added a comment - 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.
        Hide
        Marijn Huizendveld added a comment -

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

        Show
        Marijn Huizendveld added a comment - I agree with Roman. As an added bonus: that's what people are used to from Doctrine 1
        Hide
        Jonathan H. Wage added a comment -

        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?

        Show
        Jonathan H. Wage added a comment - 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?

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Marijn Huizendveld
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: