Copied!

NotificationService

NotificationService.php : 19

Service to manager user notifications. It works in the context of a current User (obtained from the PermissionResolver).

Methods

publiccreateNotification()

NotificationService.php : 75

Creates a new notification.

public createNotification(CreateStruct $createStruct) : Notification

Parameters

Name Type Default value Description
$createStruct CreateStruct - -

Return values

Notification

Tags
Throws
InvalidArgumentException

publicdeleteNotification()

NotificationService.php : 82

Deletes a notification.

public deleteNotification(Notification $notification) : void

Parameters

Name Type Default value Description
$notification Notification - -

publicgetNotification()

NotificationService.php : 40

Load single notification (by ID).

public getNotification(int $notificationId) : Notification

Parameters

Name Type Default value Description
$notificationId int -

Notification ID

Return values

Notification

Tags
Throws
NotFoundException

publicgetNotificationCount()

NotificationService.php : 64

Get count of total users notifications.

public getNotificationCount() : int

Return values

int

publicgetPendingNotificationCount()

NotificationService.php : 57

Get count of unread users notifications.

public getPendingNotificationCount() : int

Return values

int

publicloadNotifications()

NotificationService.php : 29

Get currently logged user notifications.

public loadNotifications(int $offset, int $limit) : NotificationList

Parameters

Name Type Default value Description
$offset int -

the start offset for paging

$limit int -

the number of notifications returned

Return values

NotificationList

publicmarkNotificationAsRead()

NotificationService.php : 50

Mark notification as read so it no longer bother the user.

public markNotificationAsRead(Notification $notification) : void

Parameters

Name Type Default value Description
$notification Notification - -
Tags
Throws
NotFoundException
Throws
UnauthorizedException