In the docs [1] it says:
Does this listener require that after transaction hooks be registered?
Does this mean, that the listener will run before the transaction commit if we return false and after if we return true?
In the docs [1] it says:
Does this listener require that after transaction hooks be registered?
Does this mean, that the listener will run before the transaction commit if we return false and after if we return true?
It seems, when the PostInsertEventListener is registered as EventType.POST_INSERT, the method is not called at all and the listener is always executed before committing the transaction.
However, if the listener is registered as EventType.POST_COMMIT_INSERT the method is actually called and if it returns true the listener will be called after committing the transaction. If it returns false the listener will not be called at all.
Also, if the listener is of type PostInsertEventListener the onPostInsert method will be called regardless of whether the transaction was successful or not. If the listener is of type PostCommitInsertEventListener the onPostInsert method will only be called for successful transactions. Otherwise, the onPostInsertCommitFailed method is called.