@@ -25,7 +25,7 @@ |
||
| 25 | 25 | public function test_pushing_event_to_queue() |
| 26 | 26 | { |
| 27 | 27 | $container = new Container(); |
| 28 | - // $container->bind(\Illuminate\Contracts\Container\Container::class, $container); |
|
| 28 | + // $container->bind(\Illuminate\Contracts\Container\Container::class, $container); |
|
| 29 | 29 | $queue = new Queue($container); |
| 30 | 30 | |
| 31 | 31 | |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | public function load($id) : DomainEventStream |
| 56 | 56 | { |
| 57 | 57 | $rows = $this->db->table($this->eventStoreTableName) |
| 58 | - ->select(['uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
| 59 | - ->where('uuid', $id) |
|
| 60 | - ->orderBy('playhead', 'asc') |
|
| 61 | - ->get(); |
|
| 58 | + ->select(['uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
| 59 | + ->where('uuid', $id) |
|
| 60 | + ->orderBy('playhead', 'asc') |
|
| 61 | + ->get(); |
|
| 62 | 62 | $events = []; |
| 63 | 63 | |
| 64 | 64 | foreach ($rows as $row) { |
@@ -153,12 +153,12 @@ discard block |
||
| 153 | 153 | $lastId = 0; |
| 154 | 154 | do { |
| 155 | 155 | $rows = $this->db->table($this->eventStoreTableName) |
| 156 | - ->select(['id', 'uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
| 157 | - ->whereIn('type', $eventTypes) |
|
| 158 | - ->where('id', '>', $lastId) |
|
| 159 | - ->take($take) |
|
| 160 | - ->orderBy('id') |
|
| 161 | - ->get(); |
|
| 156 | + ->select(['id', 'uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
| 157 | + ->whereIn('type', $eventTypes) |
|
| 158 | + ->where('id', '>', $lastId) |
|
| 159 | + ->take($take) |
|
| 160 | + ->orderBy('id') |
|
| 161 | + ->get(); |
|
| 162 | 162 | $events = []; |
| 163 | 163 | foreach ($rows as $row) { |
| 164 | 164 | $events[] = $this->deserializeEvent($row); |
@@ -71,20 +71,20 @@ |
||
| 71 | 71 | protected function buildEventStoreTable() |
| 72 | 72 | { |
| 73 | 73 | Schema::connection($this->config->get('cqrses.eventstore_connection')) |
| 74 | - ->create( |
|
| 75 | - $this->config->get('cqrses.eventstore_table'), |
|
| 76 | - function (Blueprint $table) { |
|
| 77 | - $table->increments('id'); |
|
| 78 | - $table->string('uuid', 56); |
|
| 79 | - $table->integer('playhead')->unsigned(); |
|
| 80 | - $table->text('metadata'); |
|
| 81 | - $table->longText('payload'); |
|
| 82 | - $table->timestamp('recorded_on')->nullable()->index(); |
|
| 83 | - $table->string('type', 255)->index(); |
|
| 84 | - $table->unique(['uuid', 'playhead']); |
|
| 74 | + ->create( |
|
| 75 | + $this->config->get('cqrses.eventstore_table'), |
|
| 76 | + function (Blueprint $table) { |
|
| 77 | + $table->increments('id'); |
|
| 78 | + $table->string('uuid', 56); |
|
| 79 | + $table->integer('playhead')->unsigned(); |
|
| 80 | + $table->text('metadata'); |
|
| 81 | + $table->longText('payload'); |
|
| 82 | + $table->timestamp('recorded_on')->nullable()->index(); |
|
| 83 | + $table->string('type', 255)->index(); |
|
| 84 | + $table->unique(['uuid', 'playhead']); |
|
| 85 | 85 | |
| 86 | - $table->index(['id', 'type']); |
|
| 87 | - } |
|
| 88 | - ); |
|
| 86 | + $table->index(['id', 'type']); |
|
| 87 | + } |
|
| 88 | + ); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | \ No newline at end of file |