Skip to content

Commit

Permalink
Added function to remove shortcuts when a sponsor is deleted.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stardog committed Aug 4, 2021
1 parent 1084d32 commit 0664349
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion class/Factory/SponsorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,18 @@ public static function delete(int $id)
{
$sponsor = self::build($id);
$sponsor->deleted = true;
return self::save($sponsor);
$result = self::save($sponsor);
self::removeShortcuts($sponsor);
return $result;
}

private static function removeShortcuts(Sponsor $sponsor)
{
$db = Database::getDB();
$tbl = $db->addTable('access_shortcuts');
$tbl->addFieldConditional('url', 'volunteer:' . $sponsor->id);
$db->setLimit(1);
$db->delete();
}

/**
Expand Down

0 comments on commit 0664349

Please sign in to comment.