Skip to content

Commit

Permalink
Refactor low-level transactions to `DatabaseTransaction/Repository->t…
Browse files Browse the repository at this point in the history
…ransaction()` API to handle nested transactions

- Important: It is recommended to update transactions to use new `DatabaseTransaction` API to ensure correct transaction handling within nested transactions.
- Introduced new `DatabaseTransaction` API usable directly via DI or via `Repository->getTransaction()`

remp/crm#3330
  • Loading branch information
burithetech committed Nov 15, 2024
1 parent 12d2f65 commit 2147484
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Repositories/InvoicesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ final public function updateItems(ActiveRow $invoice): void
{
$payment = $invoice->related('payments')->fetch();

$this->getDatabase()->transaction(function () use ($invoice, $payment) {
$this->getTransaction()->wrap(function () use ($invoice, $payment) {
$this->invoiceItemsRepository->getTable()->where([
'invoice_id' => $invoice->id,
])->delete();
Expand Down

0 comments on commit 2147484

Please sign in to comment.