Skip to content

postPersist triggered after or before database operations ? #9824

@sdev-maxime

Description

@sdev-maxime

Hi, I'm searching an Event triggered after database operations on New insert, cause the postUpdate is only on already existing data.

So I've found this:

image

"It will be invoked after the database insert operations"
But in fact, if I die()/stop my script in the listener, my database isn't updated. Is it a mistake on the documentation ?

What is the real behavior of the postPersist() event ? trigger an event on new entity after database operation or trigger an event before flush operation ?
This is confusing, because the EntityManager->persist() operation has same name too but seems different to postPersist().

Doctrine/orm 2.9
Symfony 5.4
Documentation: https://www.doctrine-project.org/projects/doctrine-orm/en/2.9/reference/events.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions