@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | public function load($id) |
55 | 55 | { |
56 | 56 | $rows = $this->db->table($this->eventStoreTableName) |
57 | - ->select(['uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
58 | - ->where('uuid', $id) |
|
59 | - ->orderBy('playhead', 'asc') |
|
60 | - ->get(); |
|
57 | + ->select(['uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
58 | + ->where('uuid', $id) |
|
59 | + ->orderBy('playhead', 'asc') |
|
60 | + ->get(); |
|
61 | 61 | $events = []; |
62 | 62 | |
63 | 63 | foreach ($rows as $row) { |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | { |
102 | 102 | try { |
103 | 103 | $this->db->table($this->eventStoreTableName) |
104 | - ->insert( |
|
105 | - [ |
|
106 | - 'uuid' => (string)$domainMessage->getId(), |
|
107 | - 'playhead' => $domainMessage->getPlayHead(), |
|
108 | - 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
|
109 | - 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
|
110 | - 'recorded_on' => (string)$domainMessage->getRecordedOn(), |
|
111 | - 'type' => $domainMessage->getType(), |
|
112 | - ] |
|
113 | - ); |
|
104 | + ->insert( |
|
105 | + [ |
|
106 | + 'uuid' => (string)$domainMessage->getId(), |
|
107 | + 'playhead' => $domainMessage->getPlayHead(), |
|
108 | + 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
|
109 | + 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
|
110 | + 'recorded_on' => (string)$domainMessage->getRecordedOn(), |
|
111 | + 'type' => $domainMessage->getType(), |
|
112 | + ] |
|
113 | + ); |
|
114 | 114 | } catch (\PDOException $ex) { |
115 | 115 | if ($ex->getCode() == 23000) { |
116 | 116 | throw new DuplicateAggregatePlayhead((string)$domainMessage->getId(), $domainMessage->getPlayHead()); |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | public function getEventsByType($eventTypes, $skip, $take) |
155 | 155 | { |
156 | 156 | $rows = $this->db->table($this->eventStoreTableName) |
157 | - ->select(['uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
158 | - ->whereIn('type', $eventTypes) |
|
159 | - ->skip($skip) |
|
160 | - ->take($take) |
|
161 | - ->orderBy('recorded_on', 'asc') |
|
162 | - ->get(); |
|
157 | + ->select(['uuid', 'playhead', 'metadata', 'payload', 'recorded_on']) |
|
158 | + ->whereIn('type', $eventTypes) |
|
159 | + ->skip($skip) |
|
160 | + ->take($take) |
|
161 | + ->orderBy('recorded_on', 'asc') |
|
162 | + ->get(); |
|
163 | 163 | $events = []; |
164 | 164 | |
165 | 165 | foreach ($rows as $row) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function append($id, DomainEventStream $eventStream) |
79 | 79 | { |
80 | - $id = (string)$id; //Used to thrown errors if ID will not cast to string |
|
80 | + $id = (string) $id; //Used to thrown errors if ID will not cast to string |
|
81 | 81 | |
82 | 82 | $this->db->beginTransaction(); |
83 | 83 | |
@@ -103,17 +103,17 @@ discard block |
||
103 | 103 | $this->db->table($this->eventStoreTableName) |
104 | 104 | ->insert( |
105 | 105 | [ |
106 | - 'uuid' => (string)$domainMessage->getId(), |
|
106 | + 'uuid' => (string) $domainMessage->getId(), |
|
107 | 107 | 'playhead' => $domainMessage->getPlayHead(), |
108 | 108 | 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), |
109 | 109 | 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), |
110 | - 'recorded_on' => (string)$domainMessage->getRecordedOn(), |
|
110 | + 'recorded_on' => (string) $domainMessage->getRecordedOn(), |
|
111 | 111 | 'type' => $domainMessage->getType(), |
112 | 112 | ] |
113 | 113 | ); |
114 | 114 | } catch (\PDOException $ex) { |
115 | 115 | if ($ex->getCode() == 23000) { |
116 | - throw new DuplicateAggregatePlayhead((string)$domainMessage->getId(), $domainMessage->getPlayHead()); |
|
116 | + throw new DuplicateAggregatePlayhead((string) $domainMessage->getId(), $domainMessage->getPlayHead()); |
|
117 | 117 | } |
118 | 118 | throw $ex; |
119 | 119 | } |