mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-23 22:09:29 +00:00
Improved noticationToDB
This commit is contained in:
parent
ecbccd1b9d
commit
6d1c5c3d2c
@ -262,6 +262,8 @@ class notificationComponent {
|
||||
|
||||
$data = array();
|
||||
|
||||
if($notification->has_id())
|
||||
$data['id'] = $notification->get_id();
|
||||
if($notification->has_seen_state())
|
||||
$data['seen'] = $notification->is_seen() ? 1 : 0;
|
||||
if($notification->has_from_user_id())
|
||||
@ -270,7 +272,9 @@ class notificationComponent {
|
||||
$data['dest_user_id'] = $notification->get_dest_user_id();
|
||||
if($notification->has_type())
|
||||
$data['type'] = $notification->get_type();
|
||||
if($notification->has_on_elem_id())
|
||||
$data['on_elem_id'] = $notification->get_on_elem_id();
|
||||
if($notification->has_on_elem_type())
|
||||
$data['on_elem_type'] = $notification->get_on_elem_type();
|
||||
|
||||
//Specify complementary fields only if required
|
||||
|
@ -89,7 +89,7 @@ class Notification {
|
||||
* @return bool TRUE if the notification as an ID / FALSE else
|
||||
*/
|
||||
public function has_id() : bool {
|
||||
return $this->id != null;
|
||||
return ($this->id != null) && ($this->id != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -219,6 +219,16 @@ class Notification {
|
||||
return $this->on_elem_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the id of element targeted by the notification has been
|
||||
* specified or not
|
||||
*
|
||||
* @return bool TRUE if the ID of the target element has been specified
|
||||
*/
|
||||
public function has_on_elem_id() : bool {
|
||||
return $this->on_elem_id != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set notification target element type
|
||||
*
|
||||
@ -237,6 +247,16 @@ class Notification {
|
||||
return $this->on_elem_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the type of element targeted by the notification has been
|
||||
* specified or not
|
||||
*
|
||||
* @return bool TRUE if the ID of the target element has been specified
|
||||
*/
|
||||
public function has_on_elem_type() : bool {
|
||||
return $this->on_elem_type != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set notification event type
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user