Skip to content

[RFC] add HydrationFactory as extension point for tracking hydrations#12411

Open
kbond wants to merge 1 commit into
doctrine:3.6.xfrom
kbond:hydrator-factory
Open

[RFC] add HydrationFactory as extension point for tracking hydrations#12411
kbond wants to merge 1 commit into
doctrine:3.6.xfrom
kbond:hydrator-factory

Conversation

@kbond

@kbond kbond commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

(Continuation of #12059)

This is a proposed extension point to help solve doctrine/DoctrineBundle#109. I'm thinking a HydratorInterface that AbstractHydrator implements should be added but wanted to get some feedback/input before going further.

The doctrine bundle could use this to add hydration times to the timeline:
Symfony-Profiler

The doctrine bundle could add something similar to https://github.com/debesha/DoctrineProfileExtraBundle#screenshots to the profiler panel.

You can see an example of how this could be used in DoctrineBundle here: https://github.com/kbond/symfony-reproducer/tree/hydration-profiler-poc (specifically kbond/symfony-reproducer@9a4e91b).

I don't think this causes any performance problems for hydration (when using the DefaultHydratorFactory).

@greg0ire

greg0ire commented Mar 28, 2026

Copy link
Copy Markdown
Member

How about having a HydrationObserver abstraction instead, that would be called at well-defined points? It would have two methods, one for the start of the hydration, and one for its end. We could provide a null implementation to avoid if checks.

@beberlei

Copy link
Copy Markdown
Member

How about having a HydrationObserver abstraction instead, that would be called at well-defined points? It would have to methods, one for the start of the hydration, and one for its end. We could provide a null implementation to avoid if checks.

I am also not happy about a factory with the main use case being "only" logging of timings.

An observer would be extra api, maybe a Hydration Start and Completed event as long as they dont allow changing things.

@github-actions

Copy link
Copy Markdown
Contributor

There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.
If you want to continue working on it, please leave a comment.

@github-actions github-actions Bot added Stale and removed Stale labels Jun 27, 2026
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

Successfully merging this pull request may close these issues.

3 participants