Skip to content

Commit

Permalink
Add todos
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiandedeyne committed Jul 26, 2023
1 parent b67b0e9 commit 69f60af
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/AggregateRoots/AggregateRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ public function persist(): static
throw $exception;
}

// @todo Instead of creating a new instance, this should reset the aggregate root state back to it's
// initial state after __construct, then re-retrieve events from the database and apply them
// on the resetted aggregate root.
$newInstance = static::retrieve($this->uuid());
$newInstance->concurrentTries = $this->concurrentTries + 1;

Expand All @@ -173,6 +176,7 @@ public function persist(): static
$newInstance->recordConcurrently($recordedEvent, $concurrencyCheck);
}

// @todo Don't return a new instance but the same one, see above todo
return $newInstance->persist();
}

Expand Down

0 comments on commit 69f60af

Please sign in to comment.