Skip to the content
Documentation

Notification events

No ratings yet

A notification event is a row in the table eznotificationevent that records something worth telling users about. Events are made at once, when the thing happens, and handled later by a notification run.

The event types of Exponential 6

Type Made when
ezpublish a version of an object is published (unless the editor chose to publish without notification)
ezcurrenttime at every run; it makes the digests that are due ready to send
ezcollaboration a collaboration item (such as an approval) gets a new message

They are listed in notification.ini [NotificationEventTypeSettings] AvailableNotificationEventTypes[], and the classes are in kernel/classes/notification/event/<type>/<type>type.php. The shipped list also names eznewcontent, but Exponential 6 has no class for it and nothing makes such events.

The life of an event

  1. The event is stored with status 0 (pending).
  2. A run hands it to every handler (see Notification handlers).
  3. When no handler needs it any more, it is removed.

Look at the events on Setup > Notification or with ./console exp:notificationevents --allow-root-user; remove old ones with --apply.

Your own event type

A type is a class that extends eZNotificationEventType, implements initializeEvent( $event, $params ) (store the parameters in the event's data_int1..4 and data_text1..4 columns) and eventContent( $event ), and registers itself with eZNotificationEventType::register(). Put it in <type>/<type>type.php below a directory listed in [NotificationEventTypeSettings] ExtensionDirectories[] or RepositoryDirectories[], and add the type to AvailableNotificationEventTypes[]. Code creates an event with eZNotificationEvent::create( '<type>', $params ) and stores it.

A complete, tested example with its handler is in Notifications: architecture, extending and testing, section 2.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.