| @@ 185-190 (lines=6) @@ | ||
| 182 | protected function appendStoredEvents($streamId, $storedEvents, $expectedVersion) |
|
| 183 | { |
|
| 184 | $this->connection->transactional(function() use ($streamId, $storedEvents, $expectedVersion) { |
|
| 185 | if (!$this->streamExists($streamId)) { |
|
| 186 | $stmt = $this->connection |
|
| 187 | ->prepare('INSERT INTO streams (id) VALUES (:streamId)'); |
|
| 188 | $stmt->bindValue(':streamId', $streamId); |
|
| 189 | $stmt->execute(); |
|
| 190 | } |
|
| 191 | foreach ($storedEvents as $storedEvent) { |
|
| 192 | $stmt = $this->connection->prepare( |
|
| 193 | 'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version) |
|
| @@ 155-160 (lines=6) @@ | ||
| 152 | { |
|
| 153 | $this->connection->beginTransaction(); |
|
| 154 | try { |
|
| 155 | if (!$this->streamExists($streamId)) { |
|
| 156 | $stmt = $this->connection |
|
| 157 | ->prepare('INSERT INTO streams (id) VALUES (:streamId)'); |
|
| 158 | $stmt->bindValue(':streamId', $streamId); |
|
| 159 | $stmt->execute(); |
|
| 160 | } |
|
| 161 | foreach ($storedEvents as $storedEvent) { |
|
| 162 | $stmt = $this->connection->prepare( |
|
| 163 | 'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version) |
|