-
-
Notifications
You must be signed in to change notification settings - Fork 62
Don't require Eloquent for storing and retrieving of events #183
Conversation
Would be great if this could be tested in an existing project that uses Event Projector before we merge this, although the tests seem pretty complete, this is a pretty drastic change. |
I’ll take a look when I get back. Feel free to do breaking changes, I don’t
mind us tagging a v3 if we provide simple upgrade instructions.
|
💙🎉👍 14eeb4a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already looks really good 👍
The reason why we do this change is to make the package a bit more flexible when storing a lot of events. With the current changes, users with a large event store might still run into trouble. We need to fix this.
@riasvdv Could you also test this out by updating the larabank apps? Just use |
Just tested both Larabank applications with the version in this branch, all functionality still works 🎉 @freekmurze Could you go over this one more time? Then we can tag v3 |
Epic PR, thanks @riasvdv |
💪 💪 |
This refactor / implementation allows you to have a different storage model other than Eloquent. For example, a simple QueryStoredEventRepository that runs mysql queries would be far more performant on millions of events than building Eloquent models for them.
This PR does the following things:
stored_event_repository
key in the configStoredEventRepository
interfaceStoredEventData
model that has the necessary dataEloquentStoredEventRepository
has been added to keep the default implementation, theStoredEvent
model is now only used in this specific implementation, customStoredEvent
models still need to extend this.OtherEloquentStoredEventRepository
is added in the tests to test the implementationUpgrade guide
stored_event_model
config key from yourevent-projector.php
config filestored_event_repository
config key with the following value:\Spatie\EventProjector\EloquentStoredEventRepository::class
\Spatie\EventProjector\Models\StoredEvent::class
has been renamed to\Spatie\EventProjector\Models\EloquentStoredEvent::class
\Spatie\EventProjector\EloquentStoredEventRepository
and change the$storedEventModel
property with your own model that extends\Spatie\EventProjector\Models\EloquentStoredEvent
stored_event_repository
config value with your own repository