@@ -121,9 +121,9 @@ |
||
| 121 | 121 | $app->bind(EventStore::class, |
| 122 | 122 | function (Application $application) { |
| 123 | 123 | return new LaravelEventStore($application->make(DatabaseManager::class), |
| 124 | - $application->make(Serializer::class), |
|
| 125 | - $application['config']->get('cqrses.eventstore_connection'), |
|
| 126 | - $application['config']->get('cqrses.eventstore_table') |
|
| 124 | + $application->make(Serializer::class), |
|
| 125 | + $application['config']->get('cqrses.eventstore_connection'), |
|
| 126 | + $application['config']->get('cqrses.eventstore_table') |
|
| 127 | 127 | ); |
| 128 | 128 | } |
| 129 | 129 | ); |
@@ -37,13 +37,13 @@ |
||
| 37 | 37 | public function handle(DomainMessage $domainMessage) |
| 38 | 38 | { |
| 39 | 39 | $this->queue->push(QueueToEventDispatcher::class, |
| 40 | - [ |
|
| 41 | - 'uuid' => (string)$domainMessage->getId(), |
|
| 42 | - 'playhead' => $domainMessage->getPlayHead(), |
|
| 43 | - 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
|
| 44 | - 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
|
| 45 | - 'recorded_on' => (string)$domainMessage->getRecordedOn(), |
|
| 46 | - 'type' => $domainMessage->getType(), |
|
| 47 | - ]); |
|
| 40 | + [ |
|
| 41 | + 'uuid' => (string)$domainMessage->getId(), |
|
| 42 | + 'playhead' => $domainMessage->getPlayHead(), |
|
| 43 | + 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
|
| 44 | + 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
|
| 45 | + 'recorded_on' => (string)$domainMessage->getRecordedOn(), |
|
| 46 | + 'type' => $domainMessage->getType(), |
|
| 47 | + ]); |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | \ No newline at end of file |
@@ -57,16 +57,16 @@ |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | Schema::connection($this->config->get('cqrses.eventstore_connection')) |
| 60 | - ->create($this->config->get('cqrses.eventstore_table'), |
|
| 61 | - function (Blueprint $table) { |
|
| 62 | - $table->increments('id'); |
|
| 63 | - $table->string('uuid', 56); |
|
| 64 | - $table->integer('playhead')->unsigned(); |
|
| 65 | - $table->text('metadata'); |
|
| 66 | - $table->text('payload'); |
|
| 67 | - $table->string('recorded_on', 32); |
|
| 68 | - $table->text('type'); |
|
| 69 | - $table->unique(['uuid', 'playhead']); |
|
| 70 | - }); |
|
| 60 | + ->create($this->config->get('cqrses.eventstore_table'), |
|
| 61 | + function (Blueprint $table) { |
|
| 62 | + $table->increments('id'); |
|
| 63 | + $table->string('uuid', 56); |
|
| 64 | + $table->integer('playhead')->unsigned(); |
|
| 65 | + $table->text('metadata'); |
|
| 66 | + $table->text('payload'); |
|
| 67 | + $table->string('recorded_on', 32); |
|
| 68 | + $table->text('type'); |
|
| 69 | + $table->unique(['uuid', 'playhead']); |
|
| 70 | + }); |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | \ No newline at end of file |
@@ -96,11 +96,11 @@ |
||
| 96 | 96 | $stub = file_get_contents($this->getStub()); |
| 97 | 97 | |
| 98 | 98 | $namespace = rtrim($this->config->get('cqrses.namespace') . $this->argument('aggregate') . '\\' . $this->getFolder(), |
| 99 | - '\\'); |
|
| 99 | + '\\'); |
|
| 100 | 100 | |
| 101 | 101 | $stub = $this->replaceStubVariable('namespace', |
| 102 | - $namespace, |
|
| 103 | - $stub); |
|
| 102 | + $namespace, |
|
| 103 | + $stub); |
|
| 104 | 104 | |
| 105 | 105 | foreach ($this->replacementVariables() as $variableName => $variableValue) { |
| 106 | 106 | $stub = $this->replaceStubVariable($variableName, $variableValue, $stub); |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | public function load($id) |
| 54 | 54 | { |
| 55 | 55 | $rows = $this->db->table($this->eventStoreTableName) |
| 56 | - ->select(['uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
| 57 | - ->where('uuid', $id) |
|
| 58 | - ->orderBy('playhead', 'asc') |
|
| 59 | - ->get(); |
|
| 56 | + ->select(['uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
| 57 | + ->where('uuid', $id) |
|
| 58 | + ->orderBy('playhead', 'asc') |
|
| 59 | + ->get(); |
|
| 60 | 60 | $events = []; |
| 61 | 61 | |
| 62 | 62 | foreach ($rows as $row) { |
@@ -103,16 +103,16 @@ discard block |
||
| 103 | 103 | private function insertEvent(DomainMessage $domainMessage) |
| 104 | 104 | { |
| 105 | 105 | $this->db->table($this->eventStoreTableName) |
| 106 | - ->insert( |
|
| 107 | - [ |
|
| 108 | - 'uuid' => (string)$domainMessage->getId(), |
|
| 109 | - 'playhead' => $domainMessage->getPlayHead(), |
|
| 110 | - 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
|
| 111 | - 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
|
| 112 | - 'recorded_on' => (string)$domainMessage->getRecordedOn(), |
|
| 113 | - 'type' => $domainMessage->getType(), |
|
| 114 | - ] |
|
| 115 | - ); |
|
| 106 | + ->insert( |
|
| 107 | + [ |
|
| 108 | + 'uuid' => (string)$domainMessage->getId(), |
|
| 109 | + 'playhead' => $domainMessage->getPlayHead(), |
|
| 110 | + 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
|
| 111 | + 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
|
| 112 | + 'recorded_on' => (string)$domainMessage->getRecordedOn(), |
|
| 113 | + 'type' => $domainMessage->getType(), |
|
| 114 | + ] |
|
| 115 | + ); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |