[PR #10581] Make "EntityChangeSet" available in PostUpdateEventArgs #12467

Open
opened 2026-01-22 16:14:08 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/10581

State: closed
Merged: No


Not a final PR yet, but why not make "EntityChangeSet" available in PostUpdateEventArgs?

I see a lot of Stack Overflow solutions were they temporary cache the Changeset in "PreUpdate", use it in "PostUpdate" and then remove it, but that not a steady solution.

With this PR you can do some magic after the entity has been updated (ok, it can still fail if the transaction fails) and check which fields has changed. For example:

    public function postUpdate(ProjectInterface $project, PostUpdateEventArgs $event): void
    {
        if ($event->hasChangedField('dateStart')) {
            $this->projectService->sendEmailAboutNewStartDate($project);
        }
    }

Todo:

  • Function "setNewValue" must only available in PreUpdateEventArgs, as you can't set the new value in PostUpdate.
**Original Pull Request:** https://github.com/doctrine/orm/pull/10581 **State:** closed **Merged:** No --- Not a final PR yet, but why not make "EntityChangeSet" available in PostUpdateEventArgs? I see a lot of Stack Overflow solutions were they temporary cache the Changeset in "PreUpdate", use it in "PostUpdate" and then remove it, but that not a steady solution. With this PR you can do some magic after the entity has been updated (ok, it can still fail if the transaction fails) and check which fields has changed. For example: ```php public function postUpdate(ProjectInterface $project, PostUpdateEventArgs $event): void { if ($event->hasChangedField('dateStart')) { $this->projectService->sendEmailAboutNewStartDate($project); } } ``` Todo: - Function "setNewValue" must only available in PreUpdateEventArgs, as you can't set the new value in PostUpdate.
admin added the pull-request label 2026-01-22 16:14:08 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#12467