@@ 195-200 (lines=6) @@ | ||
192 | protected function appendStoredEvents($streamId, $storedEvents, $expectedVersion) |
|
193 | { |
|
194 | $this->connection->transactional(function() use ($streamId, $storedEvents, $expectedVersion) { |
|
195 | if (!$this->streamExists($streamId)) { |
|
196 | $stmt = $this->connection |
|
197 | ->prepare('INSERT INTO streams (id) VALUES (:streamId)'); |
|
198 | $stmt->bindValue(':streamId', $streamId); |
|
199 | $stmt->execute(); |
|
200 | } |
|
201 | foreach ($storedEvents as $storedEvent) { |
|
202 | $stmt = $this->connection->prepare( |
|
203 | 'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version) |
@@ 165-170 (lines=6) @@ | ||
162 | { |
|
163 | $this->connection->beginTransaction(); |
|
164 | try { |
|
165 | if (!$this->streamExists($streamId)) { |
|
166 | $stmt = $this->connection |
|
167 | ->prepare('INSERT INTO streams (id) VALUES (:streamId)'); |
|
168 | $stmt->bindValue(':streamId', $streamId); |
|
169 | $stmt->execute(); |
|
170 | } |
|
171 | foreach ($storedEvents as $storedEvent) { |
|
172 | $stmt = $this->connection->prepare( |
|
173 | 'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version) |