You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you only want to write events in case a subject (such as `/books/42`) already has at least one event, import the `IsSubjectPopulated` class, use it to create a precondition, and pass it in an array as the second argument:
85
+
86
+
```php
87
+
use Thenativeweb\Eventsourcingdb\IsSubjectPopulated;
88
+
89
+
$writtenEvents = $client->writeEvents([
90
+
// events
91
+
], [
92
+
new IsSubjectPopulated('/books/42'),
93
+
]);
94
+
```
95
+
82
96
#### Using the `isSubjectOnEventId` precondition
83
97
84
98
If you only want to write events in case the last event of a subject (such as `/books/42`) has a specific ID (e.g., `0`), import the `IsSubjectOnEventId` class, use it to create a precondition, and pass it in an array as the second argument:
0 commit comments