Skip to content

Commit

Permalink
Prevent FKEY issue removing already lent object
Browse files Browse the repository at this point in the history
closes #1746
  • Loading branch information
trasher committed Nov 28, 2023
1 parent 74054e0 commit 1540f6a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/GaletteObjectsLend/Repository/Objects.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ public function removeObjects(array $ids)
try {
$this->zdb->connection->beginTransaction();

$update = $this->zdb->update(LEND_PREFIX . self::TABLE);
$update->set(['rent_id' => null]);
$update->where->in(
self::PK,
$ids
);
$this->zdb->execute($update);

$delete = $this->zdb->delete(LEND_PREFIX . LendRent::TABLE);
$delete->where->in(
self::PK,
Expand Down

0 comments on commit 1540f6a

Please sign in to comment.