Skip to content
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
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ a symfony integration of a small lightweight [event-sourcing](https://github.com
composer require patchlevel/event-sourcing-bundle
```

## config
## configuration

### Add the event bus to the symfony messenger config:
```
framework:
messenger:
Expand All @@ -22,6 +23,7 @@ framework:
default_middleware: allow_no_handlers
```

### Set the database connection
```
doctrine:
dbal:
Expand All @@ -30,6 +32,10 @@ doctrine:
url: '%env(EVENTSTORE_URL)%'
```

### Define your aggregates with class namespace and the table name

Class `App\Domain\Profile\Profile` is from the [libraries example](https://github.com/patchlevel/event-sourcing#define-aggregates) and is using the table name `profile`

```
patchlevel_event_sourcing:
store:
Expand All @@ -40,6 +46,18 @@ patchlevel_event_sourcing:
message_bus: event.bus
```

### Define which repository the aggregates is using

The service `@event_sourcing.profile_repository` with prefix `profile` is created magically from the configuration above.
In your own repository, use this configuration to auto-wire the PatchLevel repository accordingly to your aggregate.

```
services:
...
App\Infrastructure\EventSourcing\Repository\ProfileRepository:
arguments:
$repository: '@event_sourcing.profile_repository'
```

## commands

Expand Down