preFlush: PreFlushEventArgs should contain the entity being flushed #5266

Open
opened 2026-01-22 15:02:57 +01:00 by admin · 0 comments
Owner

Originally created by @andreas-glaser on GitHub (Sep 21, 2016).

Originally assigned to: @Ocramius on GitHub.

I'm working on a small library and found myself in need of the entity that is being flushed within the preFlush event. This should be part of the PreFlushEventArgs object in my opinion.

<?php
// UnitOfWork.php 
// ...
public function commit($entity = null)
    {
        // Raise preFlush
        if ($this->evm->hasListeners(Events::preFlush)) {
            $this->evm->dispatchEvent(Events::preFlush, new PreFlushEventArgs($this->em, $entity));
        }
// ...

Any thoughts on this?

Originally created by @andreas-glaser on GitHub (Sep 21, 2016). Originally assigned to: @Ocramius on GitHub. I'm working on a small library and found myself in need of the entity that is being flushed within the `preFlush` event. This should be part of the `PreFlushEventArgs` object in my opinion. ``` <?php // UnitOfWork.php // ... public function commit($entity = null) { // Raise preFlush if ($this->evm->hasListeners(Events::preFlush)) { $this->evm->dispatchEvent(Events::preFlush, new PreFlushEventArgs($this->em, $entity)); } // ... ``` Any thoughts on this?
admin added the Duplicate label 2026-01-22 15:02:57 +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#5266