← All changes
|
src/EventTickets/Repositories/EventTicketRepository.php
+6
-3
4.16.8.1
→
4.18.0
View file →
| @@ -59,8 +59,9 @@ | ||
| 59 | 59 | ->where('id', $id); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 63 | 64 | * @since 4.16.8.1 Enforce the ticket type's remaining capacity atomically with the insert (locking the ticket type row and re-counting under that lock), closing a race that let concurrent purchases jointly oversell it. |
| 64 | 65 | * @since 3.20.0 Add "amount" column to the insert statement |
| 65 | 66 | * @since 3.6.0 |
| 66 | 67 | * |
| @@ -102,9 +103,9 @@ | ||
| 102 | 103 | DB::query('ROLLBACK'); |
| 103 | 104 | |
| 104 | 105 | Log::error('Failed creating an event ticket', compact('eventTicket')); |
| 105 | 106 | |
| 106 | - throw new $exception('Failed creating an event ticket'); | |
| 107 | + throw new Exception('Failed creating an event ticket', 0, $exception); | |
| 107 | 108 | } |
| 108 | 109 | |
| 109 | 110 | $eventTicket->id = $eventTicketId; |
| 110 | 111 | $eventTicket->createdAt = $createdDateTime; |
| @@ -148,8 +149,9 @@ | ||
| 148 | 149 | return $ticketCount < (int)$capacity; |
| 149 | 150 | } |
| 150 | 151 | |
| 151 | 152 | /** |
| 153 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 152 | 154 | * @since 3.20.0 Add "amount" column to the update statement |
| 153 | 155 | * @since 3.6.0 |
| 154 | 156 | * |
| 155 | 157 | * @throws Exception|InvalidArgumentException |
| @@ -183,9 +185,9 @@ | ||
| 183 | 185 | DB::query('ROLLBACK'); |
| 184 | 186 | |
| 185 | 187 | Log::error('Failed updating an event ticket', compact('eventTicket')); |
| 186 | 188 | |
| 187 | - throw new $exception('Failed updating an event ticket'); | |
| 189 | + throw new Exception('Failed updating an event ticket', 0, $exception); | |
| 188 | 190 | } |
| 189 | 191 | |
| 190 | 192 | $eventTicket->updatedAt = $updatedDateTime; |
| 191 | 193 | |
| @@ -194,8 +196,9 @@ | ||
| 194 | 196 | Hooks::doAction('givewp_events_event_ticket_updated', $eventTicket); |
| 195 | 197 | } |
| 196 | 198 | |
| 197 | 199 | /** |
| 200 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 198 | 201 | * @since 3.6.0 |
| 199 | 202 | * |
| 200 | 203 | * @throws Exception |
| 201 | 204 | */ |
| @@ -217,9 +220,9 @@ | ||
| 217 | 220 | DB::query('ROLLBACK'); |
| 218 | 221 | |
| 219 | 222 | Log::error('Failed deleting an event ticket', compact('eventTicket')); |
| 220 | 223 | |
| 221 | - throw new $exception('Failed deleting an event ticket'); | |
| 224 | + throw new Exception('Failed deleting an event ticket', 0, $exception); | |
| 222 | 225 | } |
| 223 | 226 | |
| 224 | 227 | DB::query('COMMIT'); |
| 225 | 228 | |