From edbc49d560cad3c011b8c2ada7547be94a35eaf6 Mon Sep 17 00:00:00 2001 From: Andrea Bandera Date: Wed, 1 Jul 2015 18:48:03 +0200 Subject: [PATCH] Reset event store recorded events collection before triggering post commit event When the event store triggers the post commit event all the transaction related aspect should be closed, even the collection of recorded events stored during the transaction and made persistent into the evento store should be empty. This because if the listener of the post commit event wants to start a new transaction it should not take care of the reset ot the recorded events collection. It's not its resposibility. If the listener is insterested into what events has been committed it can look into the event itself using the getRecordeEvents method. --- src/Prooph/EventStore/EventStore.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Prooph/EventStore/EventStore.php b/src/Prooph/EventStore/EventStore.php index 81bfe7b0..fcc90767 100644 --- a/src/Prooph/EventStore/EventStore.php +++ b/src/Prooph/EventStore/EventStore.php @@ -311,9 +311,9 @@ public function commit() $event = new PostCommitEvent(__FUNCTION__ . '.post', $this, $argv); - $this->getActionEventDispatcher()->dispatch($event); - $this->recordedEvents = []; + + $this->getActionEventDispatcher()->dispatch($event); } /**