DDC-1532: PostFlush lifecycle event #1921

Closed
opened 2026-01-22 13:32:06 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Dec 13, 2011).

Originally assigned to: @lcobucci on GitHub.

Jira issue originally created by user jack@actinum.nl:

In some cases, the database-id of the newly created record is needed in some postproccessing steps, like sending an e-mail containing a link to the just created entity. I've recently seen the added support for PostFlush, but this is not a lifecycle event.

class SomeEntityClass{

/*** @PostFlush **/
function sendSomeEmail(){
    sendEmail('
        'Hi, you're new invoice can be found online: http://www.example.com/invoices/invoice_'.$this->id
    ';
}

}

Perhaps it's even possible to have multiple PostFlush events, that differentiate between the first time a record is created, and when the record is merely updated.

Originally created by @doctrinebot on GitHub (Dec 13, 2011). Originally assigned to: @lcobucci on GitHub. Jira issue originally created by user jack@actinum.nl: In some cases, the database-id of the newly created record is needed in some postproccessing steps, like sending an e-mail containing a link to the just created entity. I've recently seen the added support for PostFlush, but this is not a lifecycle event. class SomeEntityClass{ ``` /*** @PostFlush **/ function sendSomeEmail(){ sendEmail(' 'Hi, you're new invoice can be found online: http://www.example.com/invoices/invoice_'.$this->id '; } ``` } Perhaps it's even possible to have multiple PostFlush events, that differentiate between the first time a record is created, and when the record is merely updated.
admin added the Invalid label 2026-01-22 13:32:06 +01:00
admin closed this issue 2026-01-22 13:32:08 +01:00
Author
Owner

@doctrinebot commented on GitHub (Dec 14, 2011):

Comment created by jack@actinum.nl:

Okay, please ignore this issue, as I now see that the @PostPersist does exactly what I need. I was thrown by the name, because to me, the order in which stuff happens is persist -> flush. The ID's are only known after flush, so i'd expected something like postflush to exist. Sorry.

@doctrinebot commented on GitHub (Dec 14, 2011): Comment created by jack@actinum.nl: Okay, please ignore this issue, as I now see that the @PostPersist does exactly what I need. I was thrown by the name, because to me, the order in which stuff happens is persist -> flush. The ID's are only known after flush, so i'd expected something like postflush to exist. Sorry.
Author
Owner

@malukenho commented on GitHub (Jan 5, 2017):

@Ocramius @lcobucci can be closed as invalid.

@malukenho commented on GitHub (Jan 5, 2017): @Ocramius @lcobucci can be closed as invalid.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1921