Added a method to delete notifications.

This commit is contained in:
Pierre
2018-02-20 14:40:42 +01:00
parent 6d1c5c3d2c
commit 6d96091c3f
2 changed files with 96 additions and 0 deletions

View File

@ -54,6 +54,30 @@ class notificationComponent {
return $list;
}
/**
* Get the informations about a single notification
*
* @param int $notifID The target notification ID
* @return Notification The target notification
*/
public function get_single(int $notifID) : Notification {
//Perform database request
$conditions = "WHERE id = ?";
$values = array($notifID);
//Perform the request
$result = CS::get()->db->select(self::NOTIFICATIONS_TABLE, $conditions, $values);
//Check for error
if(count($result) == 0)
return new Notification(); //Return empty notification
//Parse and return notification
return $this->dbToNotification($result[0]);
}
/**
* Push a new notification
*