public function Delete() { $ItemActions = ItemAction::GetAllByField("ItemAction", "ItemID", $this->GetValue("ID")); // Delete all actions related to this item foreach ($ItemActions as $ItemAction) { // Delete all of the user actions using this Item Action $UserActions = UserAction::GetAllByField("UserAction", "ItemAction", $ItemAction->GetValue("ID")); foreach ($UserActions as $UserAction) { $UserAction->Delete(); } // Delete the actual item action $ItemAction->Delete(); } // Delete the saved image (we warned them) $this->DeleteImage(); // Literally delete the item itself Database::Query("DELETE FROM `%s` WHERE `ID` = %s;", static::$TableName, $this->Data["ID"]); DB_Accessor::FlushMemCache(get_class($this)); }