@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | public function load(string $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) { |
@@ -152,12 +152,12 @@ discard block |
||
| 152 | 152 | $rows = $this->db->table( |
| 153 | 153 | $this->db->raw("`{$this->eventStoreTableName}` FORCE INDEX (eventstore_type_index)") |
| 154 | 154 | ) |
| 155 | - ->select(['id', 'uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
| 156 | - ->whereIn('type', $eventTypes) |
|
| 157 | - ->where('id', '>', $lastId) |
|
| 158 | - ->take($take) |
|
| 159 | - ->orderBy('id') |
|
| 160 | - ->get(); |
|
| 155 | + ->select(['id', 'uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
| 156 | + ->whereIn('type', $eventTypes) |
|
| 157 | + ->where('id', '>', $lastId) |
|
| 158 | + ->take($take) |
|
| 159 | + ->orderBy('id') |
|
| 160 | + ->get(); |
|
| 161 | 161 | $events = []; |
| 162 | 162 | foreach ($rows as $row) { |
| 163 | 163 | $events[] = $this->deserializeEvent($row); |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | public function deleteStream(string $streamId) : void |
| 191 | 191 | { |
| 192 | 192 | $this->db->table($this->eventStoreTableName) |
| 193 | - ->where('uuid', $streamId) |
|
| 194 | - ->delete(); |
|
| 193 | + ->where('uuid', $streamId) |
|
| 194 | + ->delete(); |
|
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | \ No newline at end of file |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | try { |
| 108 | 108 | $this->db->table($this->eventStoreTableName)->insert($eventRow); |
| 109 | 109 | } catch (\PDOException $ex) { |
| 110 | - if ((string)$ex->getCode() === '23000') { |
|
| 110 | + if ((string) $ex->getCode() === '23000') { |
|
| 111 | 111 | throw new DuplicateAggregatePlayhead($eventRow['uuid'], $eventRow['playhead'], $ex); |
| 112 | 112 | } |
| 113 | 113 | throw $ex; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | private function domainMessageToArray(DomainMessage $domainMessage) : array |
| 176 | 176 | { |
| 177 | 177 | return [ |
| 178 | - 'uuid' => (string)$domainMessage->getId(), |
|
| 178 | + 'uuid' => (string) $domainMessage->getId(), |
|
| 179 | 179 | 'playhead' => $domainMessage->getPlayHead(), |
| 180 | 180 | 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
| 181 | 181 | 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $projectionRequest = collect(explode(',', $this->argument('projections'))); |
| 77 | 77 | |
| 78 | 78 | $projectionsServiceProviders = $projectionRequest->each( |
| 79 | - function ($projectionName) { |
|
| 79 | + function($projectionName) { |
|
| 80 | 80 | if (!isset($this->config->get('cqrses.projections_service_providers')[$projectionName])) { |
| 81 | 81 | $this->error("{$projectionName} Does not exist, check cqrses config"); |
| 82 | 82 | |
@@ -84,26 +84,26 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | )->map( |
| 87 | - function ($projectionName) { |
|
| 87 | + function($projectionName) { |
|
| 88 | 88 | return $this->application->make( |
| 89 | 89 | $this->config->get('cqrses.projections_service_providers')[$projectionName] |
| 90 | 90 | ); |
| 91 | 91 | } |
| 92 | 92 | )->each( |
| 93 | - function (ProjectionServiceProvider $projectionClass) { |
|
| 93 | + function(ProjectionServiceProvider $projectionClass) { |
|
| 94 | 94 | $this->downMigration($projectionClass); |
| 95 | 95 | } |
| 96 | 96 | )->each( |
| 97 | - function (ProjectionServiceProvider $projectionClass) { |
|
| 97 | + function(ProjectionServiceProvider $projectionClass) { |
|
| 98 | 98 | $this->upMigration($projectionClass); |
| 99 | 99 | } |
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | 102 | /** @var Collection|Subscriber[] $projections */ |
| 103 | 103 | $projections = $projectionsServiceProviders->map( |
| 104 | - function (ProjectionServiceProvider $projectServiceProvider) { |
|
| 104 | + function(ProjectionServiceProvider $projectServiceProvider) { |
|
| 105 | 105 | return collect($projectServiceProvider->getProjections())->map( |
| 106 | - function ($projection) { |
|
| 106 | + function($projection) { |
|
| 107 | 107 | return $this->application->make($projection); |
| 108 | 108 | } |
| 109 | 109 | ); |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | )->collapse(); |
| 112 | 112 | |
| 113 | 113 | $events = $projections->map( |
| 114 | - function (Subscriber $subscriber) { |
|
| 114 | + function(Subscriber $subscriber) { |
|
| 115 | 115 | return array_keys($subscriber->getSubscribedEvents()); |
| 116 | 116 | } |
| 117 | 117 | )->collapse()->map( |
| 118 | - function ($eventClassName) { |
|
| 118 | + function($eventClassName) { |
|
| 119 | 119 | return str_replace('\\', '.', $eventClassName); |
| 120 | 120 | } |
| 121 | 121 | ); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | public function downMigration(ProjectionServiceProvider $projectionServiceProvider) |
| 130 | 130 | { |
| 131 | 131 | $response = $projectionServiceProvider->down(); |
| 132 | - $this->line($response ?? 'Migrated Down: ' . \get_class($projectionServiceProvider)); |
|
| 132 | + $this->line($response ?? 'Migrated Down: '.\get_class($projectionServiceProvider)); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | public function upMigration(ProjectionServiceProvider $projectionServiceProvider) |
| 139 | 139 | { |
| 140 | 140 | $response = $projectionServiceProvider->up(); |
| 141 | - $this->line($response ?? 'Migrated Up: ' . \get_class($projectionServiceProvider)); |
|
| 141 | + $this->line($response ?? 'Migrated Up: '.\get_class($projectionServiceProvider)); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | protected function replayEvents($projections, $events) |
| 151 | 151 | { |
| 152 | 152 | $eventCount = $this->eventStore->getEventCountByTypes($events); |
| 153 | - $take = (int)$this->config->get('cqrses.rebuild_transaction_size', 1000); |
|
| 153 | + $take = (int) $this->config->get('cqrses.rebuild_transaction_size', 1000); |
|
| 154 | 154 | |
| 155 | 155 | $this->output->progressStart($eventCount); |
| 156 | 156 | $dispatcher = $this->buildAndRegisterDispatcher($projections); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | $this->output->progressFinish(); |
| 173 | - $this->line((memory_get_peak_usage(true) / 1024 / 1024) . "mb Peak Usage", false); |
|
| 173 | + $this->line((memory_get_peak_usage(true) / 1024 / 1024)."mb Peak Usage", false); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | ); |
| 204 | 204 | |
| 205 | 205 | $projections->each( |
| 206 | - function ($projection) use ($dispatcher) { |
|
| 206 | + function($projection) use ($dispatcher) { |
|
| 207 | 207 | $dispatcher->addSubscriber($projection); |
| 208 | 208 | } |
| 209 | 209 | ); |