Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide docblocks to AggregateRoot class #31

Merged
merged 1 commit into from
Oct 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/AggregateRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ abstract class AggregateRoot
/** @var array */
private $recordedEvents = [];

/**
* @param string $uuid
* @return static
*/
public static function retrieve(string $uuid): AggregateRoot
{
$aggregateRoot = (new static());
Expand All @@ -22,6 +26,10 @@ public static function retrieve(string $uuid): AggregateRoot
return $aggregateRoot->reconstituteFromEvents();
}

/**
* @param ShouldBeStored $domainEvent
* @return static
*/
public function recordThat(ShouldBeStored $domainEvent): AggregateRoot
{
$this->recordedEvents[] = $domainEvent;
Expand All @@ -31,6 +39,9 @@ public function recordThat(ShouldBeStored $domainEvent): AggregateRoot
return $this;
}

/**
* @return static
*/
public function persist(): AggregateRoot
{
$storedEvents = call_user_func(
Expand Down