/** * Clears all recorded events. */ public final function commitChanges() { if (null !== $this->changes) { $this->lastCommittedEventSequenceNumber = $this->changes->lastSequenceNumber(); $this->changes->commit(); } }
/** * Return the event container containing the uncommitted changes. * If there are no pending changes to be committed, a new domain event stream is * resolved from a domain event stream factory. * * @return EventContainer */ private final function changes() { if (null === $this->changes) { $lastCommittedEventSequenceNumber = $this->lastCommittedEventSequenceNumber(); $this->changes = $this->eventContainerFactory()->create($this->identifier()); // Todo: has this method says, initialization should be done at init. $this->changes->initializeSequenceNumber($lastCommittedEventSequenceNumber); } return $this->changes; }