PostLoad event on fetch joined entities - Lifecycle Callback not firing #5612

Closed
opened 2026-01-22 15:12:42 +01:00 by admin · 4 comments
Owner

Originally created by @stoccc on GitHub (Jul 21, 2017).

Originally assigned to: @Ocramius on GitHub.

I have a problem with a Lifecycle Callback of Doctrine ORM: the callback is not executed on fetch-joined entities, while it's regularly executed on entities that are lazy-loaded.

Is there a bug in the ObjectHydrator, or it is a lack of documentation about that?

See this question on stackoverflow

Originally created by @stoccc on GitHub (Jul 21, 2017). Originally assigned to: @Ocramius on GitHub. I have a problem with a [Lifecycle Callback of Doctrine ORM](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#lifecycle-callbacks): the callback is not executed on fetch-joined entities, while it's regularly executed on entities that are lazy-loaded. Is there a bug in the ObjectHydrator, or it is a lack of documentation about that? See [this question on stackoverflow](https://stackoverflow.com/questions/45211316/doctrine-postload-lifecycle-callback-not-executed-in-fetchjoin)
admin added the BugInvalid labels 2026-01-22 15:12:42 +01:00
admin closed this issue 2026-01-22 15:12:43 +01:00
Author
Owner

@Ocramius commented on GitHub (Jul 21, 2017):

Any load operation should trigger postLoad events, so this is a bug. Can
you submit a test case to be added to our test suite?

On 21 Jul 2017 09:28, "stoccc" notifications@github.com wrote:

I have a problem with a Lifecycle Callback of Doctrine ORM
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#lifecycle-callbacks:
the callback is not executed on fetch-joined entities, while it's regularly
executed on entities that are lazy-loaded.

Is there a bug in the ObjectHydrator, or it is a lack of documentation
about that?

See this question on stackoverflow
https://stackoverflow.com/questions/45211316/doctrine-postload-lifecycle-callback-not-executed-in-fetchjoin


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/6568, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakNngALqVjHN9rC7paj5DntVTSGtVks5sQFMigaJpZM4OfDYL
.

@Ocramius commented on GitHub (Jul 21, 2017): Any load operation should trigger postLoad events, so this is a bug. Can you submit a test case to be added to our test suite? On 21 Jul 2017 09:28, "stoccc" <notifications@github.com> wrote: > I have a problem with a Lifecycle Callback of Doctrine ORM > <http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#lifecycle-callbacks>: > the callback is not executed on fetch-joined entities, while it's regularly > executed on entities that are lazy-loaded. > > Is there a bug in the ObjectHydrator, or it is a lack of documentation > about that? > > See this question on stackoverflow > <https://stackoverflow.com/questions/45211316/doctrine-postload-lifecycle-callback-not-executed-in-fetchjoin> > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/doctrine/doctrine2/issues/6568>, or mute the thread > <https://github.com/notifications/unsubscribe-auth/AAJakNngALqVjHN9rC7paj5DntVTSGtVks5sQFMigaJpZM4OfDYL> > . >
Author
Owner

@stoccc commented on GitHub (Jul 21, 2017):

I'm not so expert, I hope I did the right thing!

@stoccc commented on GitHub (Jul 21, 2017): I'm not so expert, I hope I did the right thing!
Author
Owner

@Ocramius commented on GitHub (Jul 21, 2017):

@stoccc test looks good, thanks!

@Ocramius commented on GitHub (Jul 21, 2017): @stoccc test looks good, thanks!
Author
Owner

@stoccc commented on GitHub (Jul 21, 2017):

@Ocramius
I fixed the patch, and now all tests pass correctly.
I think you should remove Bug label, but you gained a test case :)

The problem was in my application, I was using in PostLoad of the root entity some informations setted in PostLoad of the fetchjoined entities, but certainly no one can guarantee me that one PostLoad is executed before or after some other PostLoad.

I close, thanks for your time.

@stoccc commented on GitHub (Jul 21, 2017): @Ocramius I fixed the patch, and now all tests pass correctly. I think you should remove Bug label, but you gained a test case :) The problem was in my application, I was using in PostLoad of the root entity some informations setted in PostLoad of the fetchjoined entities, but certainly no one can guarantee me that one PostLoad is executed before or after some other PostLoad. I close, thanks for your time.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5612