madewithlove / laravel-cqrs-es Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Writing commands and events is a lot of work and it's something that could be generated from a schema or CLI.
Laravel already has various make:
commands so we should stick to using those.
Some useful generators:
make:command
App\${Aggregate}\Commands\${name}
App\${Aggregate}\CommandHandlers\${name}
tests_path()/App\${Aggregate}\CommandHandlers\${name}Test
make:event
make:read-model
Couple of concerns:
tests_path()
configurable? Laravel doesn't have it by default and the location can vary (codeception, PHPUnit, PHPSpec, ...)TODOS_
tests_path
deserializationCallbacks
for each parameterWriteRepositoryInterface
DbalWriteRepository
->type is always empty in this line:
$this->settings->type = $this->option('type');
When changing the code to just use $this->type everything works.
Laravel 5.5
I have several database connections configured in my config/database.php file, for example:
'connections' => [
'event_sourcing' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
'crud' => [
'driver' => 'mysql',
'host' => env('DB_CRUD_HOST', '127.0.0.1'),
'port' => env('DB_CRUD_PORT', '3306'),
'database' => env('DB_CRUD_DATABASE', 'forge'),
'username' => env('DB_CRUD_USERNAME', 'forge'),
'password' => env('DB_CRUD_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
],
And I want to use the "event_sourcing" connection as default. But when I do that, I get an error while running my migration: "The given 'driver' pdo_event_sourcing is unknown, Doctrine currently supports only the following drivers: (...)".
After some debugging I found the following line which is responsible for this bug: https://github.com/madewithlove/laravel-cqrs-es/blame/develop/src/EventStore/EventStoreManager.php#L35
Why is it overwriting my "driver" setting? I have already configured that in config/database.php
, but because of that line I can't name my connection anything else than mysql
.
Code wise it's already done on master
, but Laravel has a dependency on ramsey/uuid:3
while broadway:0.10
has one for ramsey/uuid:2.4
. In 1.0.0
broadway is adding support for ramsey/uuid:3
so to avoid upgrading issues for this package we should wait till a 1.0.0 version is tagged.
Currently when doing event-store:replay
it will still keep old read models around. Ideally these should be cleared.
Since read models can be stored in different drivers we should write the logic ourselves but instead provide an API so that people can hook into these events.
My proposal is to trigger the following application events:
event-store.replay.before
event-store.replay.after
This would allow package consumers to listen for these events and executed the necessary logic.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.