File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -41,16 +41,24 @@ public function run()
4141
4242 $ start = \microtime (true );
4343
44+ $ streamName = new StreamName ($ this ->category . '- ' . $ this ->id );
45+
4446 for ($ i = 0 ; $ i < $ this ->executions ; $ i ++) {
4547 $ count += $ this ->numberOfEvents ;
46- $ streamName = $ this ->category . '- ' . Uuid::uuid4 ()->toString ();
4748 $ events = createTestEvents (testPayload (), $ this ->numberOfEvents );
4849
4950 if ($ eventStore instanceof TransactionalEventStore) {
5051 $ eventStore ->beginTransaction ();
5152 }
5253
53- $ eventStore ->create (new Stream (new StreamName ($ streamName ), \SplFixedArray::fromArray ($ events )));
54+ if (getenv ('STREAM_STRATEGY ' ) === 'Aggregate ' ) {
55+ $ streamName = $ this ->category . '- ' . Uuid::uuid4 ()->toString ();
56+ $ eventStore ->create (new Stream (new StreamName ($ streamName ), \SplFixedArray::fromArray ($ events )));
57+ } elseif ($ i === 0 && $ eventStore ->hasStream ($ streamName ) === false ) {
58+ $ eventStore ->create (new Stream ($ streamName , \SplFixedArray::fromArray ($ events )));
59+ } else {
60+ $ eventStore ->appendTo ($ streamName , \SplFixedArray::fromArray ($ events ));
61+ }
5462
5563 if ($ eventStore instanceof TransactionalEventStore) {
5664 $ eventStore ->commit ();
You can’t perform that action at this time.
0 commit comments