Skip to content

Commit

Permalink
fix uuid documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBadura authored Jul 27, 2022
1 parent 83109ce commit c9f84a9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docs/pages/uuid.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ A UUID can be generated for the `aggregateId`. There are two popular libraries t
The `aggregate` does not care how the id is generated, since only an aggregate-wide unique string is expected here.

```php
use Patchlevel\EventSourcing\Aggregate\AggregateChanged;
use Patchlevel\EventSourcing\Aggregate\AggregateRoot;
use Patchlevel\EventSourcing\Attribute\Aggregate;
use Patchlevel\EventSourcing\Attribute\Apply;
Expand Down Expand Up @@ -41,7 +40,7 @@ final class Profile extends AggregateRoot
$id = Uuid::uuid4();

$self = new self();
$self->recordThat(ProfileCreated::raise($id, $name));
$self->recordThat(new ProfileCreated($id, $name));

return $self;
}
Expand Down Expand Up @@ -84,7 +83,6 @@ class ProfileId
```

```php
use Patchlevel\EventSourcing\Aggregate\AggregateChanged;
use Patchlevel\EventSourcing\Aggregate\AggregateRoot;
use Patchlevel\EventSourcing\Attribute\Aggregate;
use Patchlevel\EventSourcing\Attribute\Apply;
Expand Down Expand Up @@ -117,7 +115,7 @@ final class Profile extends AggregateRoot
$id = ProfileId::generate();

$self = new self();
$self->recordThat(ProfileCreated::raise($id, $name));
$self->recordThat(new ProfileCreated($id, $name));

return $self;
}
Expand All @@ -130,3 +128,8 @@ final class Profile extends AggregateRoot
}
}
```

!!! note

If you want to use snapshots, then you have to make sure that the value objects are normalized.
You can find how to do this [here](normalizer.md).

0 comments on commit c9f84a9

Please sign in to comment.