From ce4af5f75ff07b65681bd541dcf9a80d39a7b6a2 Mon Sep 17 00:00:00 2001 From: Jonas Drieghe Date: Fri, 22 Apr 2016 16:41:32 +0200 Subject: [PATCH] binding eventbus and eveentdispatcher --- src/EventStore/ServiceProvider.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/EventStore/ServiceProvider.php b/src/EventStore/ServiceProvider.php index bcc1de3..765a4c3 100644 --- a/src/EventStore/ServiceProvider.php +++ b/src/EventStore/ServiceProvider.php @@ -2,6 +2,10 @@ namespace Madewithlove\LaravelCqrsEs\EventStore; +use Broadway\EventDispatcher\EventDispatcher; +use Broadway\EventDispatcher\EventDispatcherInterface; +use Broadway\EventHandling\EventBusInterface; +use Broadway\EventHandling\SimpleEventBus; use Broadway\EventStore\EventStoreInterface; use Broadway\EventStore\Management\EventStoreManagementInterface; use Madewithlove\LaravelCqrsEs\EventStore\Console\Replay; @@ -26,6 +30,13 @@ public function register() return (new EventStoreManager($this->app))->driver(); }); + $this->app->singleton(EventDispatcherInterface::class, function () { + return new EventDispatcher(); + }); + $this->app->singleton(EventBusInterface::class, function () { + return new SimpleEventBus(); + }); + $this->app->alias(EventStoreInterface::class, 'event_store.driver'); $this->app->alias(EventStoreManagementInterface::class, 'event_store.driver'); }