@@ 166-171 (lines=6) @@ | ||
163 | protected function appendStoredEvents($streamId, $storedEvents, $expectedVersion) |
|
164 | { |
|
165 | $this->connection->transactional(function() use ($streamId, $storedEvents, $expectedVersion) { |
|
166 | if (!$this->streamExists($streamId)) { |
|
167 | $stmt = $this->connection |
|
168 | ->prepare('INSERT INTO streams (id) VALUES (:streamId)'); |
|
169 | $stmt->bindValue(':streamId', $streamId); |
|
170 | $stmt->execute(); |
|
171 | } |
|
172 | foreach ($storedEvents as $storedEvent) { |
|
173 | $stmt = $this->connection->prepare( |
|
174 | 'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version) |
@@ 136-141 (lines=6) @@ | ||
133 | { |
|
134 | $this->connection->beginTransaction(); |
|
135 | try { |
|
136 | if (!$this->streamExists($streamId)) { |
|
137 | $stmt = $this->connection |
|
138 | ->prepare('INSERT INTO streams (id) VALUES (:streamId)'); |
|
139 | $stmt->bindValue(':streamId', $streamId); |
|
140 | $stmt->execute(); |
|
141 | } |
|
142 | foreach ($storedEvents as $storedEvent) { |
|
143 | $stmt = $this->connection->prepare( |
|
144 | 'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version) |