5353 */
5454final class Configuration
5555{
56- public const STORE_DBAL_AGGREGATE = 'dbal_aggregate ' ;
5756 public const STORE_DBAL_STREAM = 'dbal_stream ' ;
5857 public const STORE_IN_MEMORY = 'in_memory ' ;
5958 public const STORE_CUSTOM = 'custom ' ;
6059
6160 public const EVENT_BUS_DEFAULT = 'default ' ;
61+ public const EVENT_BUS_PSR14 = 'psr14 ' ;
6262 public const EVENT_BUS_CUSTOM = 'custom ' ;
63- public const EVENT_BUS_NONE = 'none ' ;
6463
6564 public const COMMAND_BUS_DEFAULT = 'default ' ;
6665 public const COMMAND_BUS_CUSTOM = 'custom ' ;
@@ -156,6 +155,7 @@ final class Configuration
156155
157156 public string $ storeType = self ::STORE_IN_MEMORY ;
158157 public bool $ readOnlyStore = false ;
158+ public bool $ eventBusEnabled = false ;
159159 public string $ eventBusType = self ::EVENT_BUS_DEFAULT ;
160160 public string |null $ connectionService = null ;
161161 public string |null $ storeService = null ;
@@ -221,6 +221,9 @@ final class Configuration
221221
222222 /** @var array<Guesser> */
223223 public array $ guesser = [];
224+ public string |null $ connectionUrl = null ;
225+ public bool $ dedicatedProjectionConnection = false ;
226+ public bool $ subscriptionRunAfterAggregateSaveEnabled = false ;
224227
225228 public function withAggregates (string ...$ aggregates ): self
226229 {
@@ -264,16 +267,44 @@ public function withService(string $id, object $service): self
264267 }
265268
266269 /** @param StoreOptions $options */
267- public function withStore ( string $ type , array $ options = [], bool $ readOnly = false ): self
270+ public function withStreamStore ( array $ options = [], bool $ readOnly = false ): self
268271 {
269272 $ newConfiguration = clone $ this ;
270- $ newConfiguration ->storeType = $ type ;
273+ $ newConfiguration ->storeType = self :: STORE_DBAL_STREAM ;
271274 $ newConfiguration ->storeOptions = $ options ;
272275 $ newConfiguration ->readOnlyStore = $ readOnly ;
273276
274277 return $ newConfiguration ;
275278 }
276279
280+ /** @param StoreOptions $options */
281+ public function withInMemoryStore (array $ options = []): self
282+ {
283+ $ newConfiguration = clone $ this ;
284+ $ newConfiguration ->storeType = self ::STORE_IN_MEMORY ;
285+ $ newConfiguration ->storeOptions = $ options ;
286+
287+ return $ newConfiguration ;
288+ }
289+
290+ /** @param StoreOptions $options */
291+ public function withCustomStore (string $ store ): self
292+ {
293+ $ newConfiguration = clone $ this ;
294+ $ newConfiguration ->storeType = self ::STORE_CUSTOM ;
295+ $ newConfiguration ->storeService = $ store ;
296+
297+ return $ newConfiguration ;
298+ }
299+
300+ public function withConnectionUrl (string $ url ): self
301+ {
302+ $ newConfiguration = clone $ this ;
303+ $ newConfiguration ->connectionUrl = $ url ;
304+
305+ return $ newConfiguration ;
306+ }
307+
277308 public function withConnectionService (string |null $ connectionService ): self
278309 {
279310 $ newConfiguration = clone $ this ;
@@ -282,6 +313,14 @@ public function withConnectionService(string|null $connectionService): self
282313 return $ newConfiguration ;
283314 }
284315
316+ public function withDedicatedProjectionConnection (): self
317+ {
318+ $ newConfiguration = clone $ this ;
319+ $ newConfiguration ->dedicatedProjectionConnection = true ;
320+
321+ return $ newConfiguration ;
322+ }
323+
285324 public function withStoreService (string |null $ storeService ): self
286325 {
287326 $ newConfiguration = clone $ this ;
@@ -293,6 +332,7 @@ public function withStoreService(string|null $storeService): self
293332 public function withEventBus (string $ type = self ::EVENT_BUS_DEFAULT ): self
294333 {
295334 $ newConfiguration = clone $ this ;
335+ $ newConfiguration ->eventBusEnabled = true ;
296336 $ newConfiguration ->eventBusType = $ type ;
297337
298338 return $ newConfiguration ;
@@ -387,9 +427,7 @@ public function withSnapshotAdapters(array $snapshotAdapters): self
387427 return $ newConfiguration ;
388428 }
389429
390- /**
391- * @param array<Guesser> $guesser
392- */
430+ /** @param array<Guesser> $guesser */
393431 public function withLegacyHydrator (array $ guesser = []): self
394432 {
395433 $ newConfiguration = clone $ this ;
@@ -399,7 +437,6 @@ public function withLegacyHydrator(array $guesser = []): self
399437 return $ newConfiguration ;
400438 }
401439
402-
403440 public function withLazyHydrator (bool $ hydratorDefaultLazy ): self
404441 {
405442 $ newConfiguration = clone $ this ;
@@ -480,11 +517,6 @@ public function withCommandBus(string $type = self::COMMAND_BUS_DEFAULT): self
480517 return $ newConfiguration ;
481518 }
482519
483- public function withoutCommandBus (): self
484- {
485- return $ this ->withCommandBus (self ::COMMAND_BUS_NONE );
486- }
487-
488520 public function withCommandBusService (string |null $ commandBusService ): self
489521 {
490522 $ newConfiguration = clone $ this ;
@@ -683,6 +715,7 @@ public function withRunSubscriptionsAfterAggregateSave(
683715 int |null $ limit = null ,
684716 ): self {
685717 $ newConfiguration = clone $ this ;
718+ $ newConfiguration ->subscriptionRunAfterAggregateSaveEnabled = true ;
686719 $ newConfiguration ->subscriptionRunAfterAggregateSaveIds = $ ids ;
687720 $ newConfiguration ->subscriptionRunAfterAggregateSaveGroups = $ groups ;
688721 $ newConfiguration ->subscriptionRunAfterAggregateSaveLimit = $ limit ;
@@ -692,12 +725,11 @@ public function withRunSubscriptionsAfterAggregateSave(
692725
693726 /** @param list<int> $retriesInMs */
694727 public function withSubscriptionGapDetection (
695- bool $ enabled = true ,
696728 array $ retriesInMs = [0 , 5 , 50 , 500 ],
697729 DateInterval |null $ detectionWindow = null ,
698730 ): self {
699731 $ newConfiguration = clone $ this ;
700- $ newConfiguration ->subscriptionGapDetection = $ enabled ;
732+ $ newConfiguration ->subscriptionGapDetection = true ;
701733 $ newConfiguration ->subscriptionGapDetectionRetriesInMs = $ retriesInMs ;
702734 $ newConfiguration ->subscriptionGapDetectionWindow = $ detectionWindow ;
703735
0 commit comments