@@ -101,7 +101,6 @@ |
||
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * @param array $eventRow |
| 104 | - * @param bool $ignorePlayhead |
|
| 105 | 104 | * @throws DuplicateAggregatePlayhead |
| 106 | 105 | * @throws \PDOException |
| 107 | 106 | */ |
@@ -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); |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\EventStore; |
| 4 | 4 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function append($id, DomainEventStream $eventStream) : void |
| 83 | 83 | { |
| 84 | - $id = (string)$id; //Used to thrown errors if ID will not cast to string |
|
| 84 | + $id = (string) $id; //Used to thrown errors if ID will not cast to string |
|
| 85 | 85 | |
| 86 | 86 | $this->db->reconnect(); |
| 87 | 87 | $this->db->beginTransaction(); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | try { |
| 111 | 111 | $this->db->table($this->eventStoreTableName)->insert($eventRow); |
| 112 | 112 | } catch (\PDOException $ex) { |
| 113 | - if ((string)$ex->getCode() === '23000') { |
|
| 113 | + if ((string) $ex->getCode() === '23000') { |
|
| 114 | 114 | throw new DuplicateAggregatePlayhead($eventRow['uuid'], $eventRow['playhead'], $ex); |
| 115 | 115 | } |
| 116 | 116 | throw $ex; |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | private function domainMessageToArray(DomainMessage $domainMessage) : array |
| 177 | 177 | { |
| 178 | 178 | return [ |
| 179 | - 'uuid' => (string)$domainMessage->getId(), |
|
| 179 | + 'uuid' => (string) $domainMessage->getId(), |
|
| 180 | 180 | 'playhead' => $domainMessage->getPlayHead(), |
| 181 | 181 | 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
| 182 | 182 | 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\CommandBus; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\CommandBus; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | namespace SmoothPhp\LaravelAdapter\QueuedEventDispatcher; |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | namespace SmoothPhp\LaravelAdapter\QueuedEventDispatcher; |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\StrongConsistency; |
| 4 | 4 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function execute(Command $command, callable $next) |
| 25 | 25 | { |
| 26 | - $this->lastCommandId = (string)$command; |
|
| 26 | + $this->lastCommandId = (string) $command; |
|
| 27 | 27 | $next($command); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\StrongConsistency; |
| 4 | 4 | |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | $this->queue->push( |
| 56 | 56 | QueueToEventDispatcherWithCommandId::class, |
| 57 | 57 | [ |
| 58 | - 'uuid' => (string)$domainMessage->getId(), |
|
| 58 | + 'uuid' => (string) $domainMessage->getId(), |
|
| 59 | 59 | 'playhead' => $domainMessage->getPlayHead(), |
| 60 | 60 | 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
| 61 | 61 | 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
| 62 | - 'recorded_on' => (string)$domainMessage->getRecordedOn(), |
|
| 62 | + 'recorded_on' => (string) $domainMessage->getRecordedOn(), |
|
| 63 | 63 | 'type' => $domainMessage->getType(), |
| 64 | 64 | 'command_id' => $this->notificationsCommandBus->getLastCommandId(), |
| 65 | 65 | ], |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\StrongConsistency; |
| 4 | 4 | |
@@ -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 |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace SmoothPhp\LaravelAdapter\Console; |
| 4 | 4 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | Schema::connection($this->config->get('cqrses.eventstore_connection')) |
| 74 | 74 | ->create( |
| 75 | 75 | $this->config->get('cqrses.eventstore_table'), |
| 76 | - function (Blueprint $table) { |
|
| 76 | + function(Blueprint $table) { |
|
| 77 | 77 | $table->increments('id'); |
| 78 | 78 | $table->string('uuid', 56); |
| 79 | 79 | $table->integer('playhead')->unsigned(); |