Skip to content

Commit

Permalink
Merge pull request #202 from patchlevel/event-metadata
Browse files Browse the repository at this point in the history
Event metadata
  • Loading branch information
DavidBadura authored Apr 3, 2022
2 parents 668aa83 + 133ad67 commit 917d2ec
Show file tree
Hide file tree
Showing 86 changed files with 1,500 additions and 810 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mutation-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
dependencies:
- "locked"
php-version:
- "8.0"
- "8.1"
operating-system:
- "ubuntu-latest"

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ phpcs-check: vendor
vendor/bin/phpcs

.PHONY: phpcs-fix
phpcs-fix: vendor ## run phpcs fixer
cs: vendor ## run phpcs fixer
vendor/bin/phpcbf

.PHONY: phpstan
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ First we define the events that happen in our system.
A hotel can be created with a `name`:

```php
#[Event('hotel.created')]
final class HotelCreated
{
public function __construct(
Expand All @@ -69,6 +70,7 @@ final class HotelCreated
A guest can check in by name:

```php
#[Event('hotel.guest.checked_in')]
final class GuestIsCheckedIn
{
public function __construct(
Expand All @@ -81,6 +83,7 @@ final class GuestIsCheckedIn
And also check out again:

```php
#[Event('hotel.guest.checked_out')]
final class GuestIsCheckedOut
{
public function __construct(
Expand Down Expand Up @@ -296,6 +299,7 @@ use Patchlevel\EventSourcing\EventBus\DefaultEventBus;
use Patchlevel\EventSourcing\Projection\DefaultProjectionHandler;
use Patchlevel\EventSourcing\Projection\ProjectionListener;
use Patchlevel\EventSourcing\Repository\DefaultRepository;
use Patchlevel\EventSourcing\Serializer\JsonSerializer;
use Patchlevel\EventSourcing\Store\SingleTableStore;

$connection = DriverManager::getConnection([
Expand All @@ -313,8 +317,11 @@ $eventBus = new DefaultEventBus();
$eventBus->addListener(new ProjectionListener($projectionHandler));
$eventBus->addListener(new SendCheckInEmailListener($mailer));

$serializer = JsonSerializer::createDefault(['src/Domain/Hotel/Event']);

$store = new SingleTableStore(
$connection,
$serializer,
[Hotel::class => 'hotel'],
'eventstore'
);
Expand Down
11 changes: 1 addition & 10 deletions baseline.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
<file src="src/Serializer/DefaultHydrator.php">
<MixedAssignment occurrences="5">
<code>$data[$propertyMetadata['fieldName']]</code>
<code>$value</code>
<code>$value</code>
<code>$value</code>
<code>$value</code>
</MixedAssignment>
</file>
<file src="src/Store/MultiTableStore.php">
<UnnecessaryVarAnnotation occurrences="1">
<code>array{id: string, aggregate_id: string, playhead: string, event: class-string, payload: string, recorded_on: string}|null</code>
<code>array{id: string, aggregate_id: string, playhead: string, event: string, payload: string, recorded_on: string}|null</code>
</UnnecessaryVarAnnotation>
</file>
<file src="tests/Benchmark/BasicImplementation/Aggregate/Profile.php">
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"php": "~8.0.0|~8.1.0",
"doctrine/dbal": "^3.2.0",
"psr/cache": "^2.0.0|^3.0.0",
"psr/simple-cache": "^2.0.0|^3.0.0"
"psr/simple-cache": "^2.0.0|^3.0.0",
"symfony/finder": "^4.4.34|^5.4.0|^6.0.1"
},
"require-dev": {
"ext-pdo_sqlite": "~8.0.0|~8.1.0",
Expand Down
Loading

0 comments on commit 917d2ec

Please sign in to comment.