protected function ActivityNotifications::getNotificationIds in Open Social 8.9
Same name and namespace in other branches
- 8 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8.2 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8.3 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8.4 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8.5 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8.6 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8.7 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8.8 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 10.3.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 10.0.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 10.1.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 10.2.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
Returns the Activity ids for an account with destination 'notification'.
Parameters
\Drupal\Core\Session\AccountInterface $account: Account object.
array $status: Array of notification statuses.
Return value
array Returns an array of notification ids or empty array.
4 calls to ActivityNotifications::getNotificationIds()
- ActivityNotifications::getNotifications in modules/
custom/ activity_creator/ src/ ActivityNotifications.php - Returns the Notifications for a given account.
- ActivityNotifications::getNotificationsActivities in modules/
custom/ activity_creator/ src/ ActivityNotifications.php - Returns the Activity objects with destination 'notification' for account.
- ActivityNotifications::markAllNotificationsAsSeen in modules/
custom/ activity_creator/ src/ ActivityNotifications.php - Mark all notifications as Seen for account.
- ActivityNotifications::markEntityAsRead in modules/
custom/ activity_creator/ src/ ActivityNotifications.php - Mark an entity as read for a given account.
File
- modules/
custom/ activity_creator/ src/ ActivityNotifications.php, line 222
Class
- ActivityNotifications
- Class ActivityNotifications to get Personalised activity items for account.
Namespace
Drupal\activity_creatorCode
protected function getNotificationIds(AccountInterface $account, array $status = []) : array {
// Get the user ID.
if (!empty($uid = $account
->id())) {
try {
$query = $this->database
->select('activity_notification_status', 'ans')
->fields('ans', [
'aid',
])
->condition('uid', $uid);
if (!empty($status)) {
$query
->condition('status', $status, 'IN');
}
return $query
->execute()
->fetchCol();
} catch (\Exception $exception) {
// Log the exception to watchdog.
$this
->getLogger('default')
->error($exception
->getMessage());
}
}
else {
return [];
}
}