File size: 1,070 Bytes
e4f4821 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
<?php
namespace Kanboard\Job;
use Kanboard\Event\GenericEvent;
/**
* Class NotificationJob
*
* @package Kanboard\Job
* @author Frederic Guillot
*/
class NotificationJob extends BaseJob
{
/**
* Set job parameters
*
* @param GenericEvent $event
* @param string $eventName
* @return $this
*/
public function withParams(GenericEvent $event, $eventName)
{
$this->jobParams = array($event->getAll(), $eventName);
return $this;
}
/**
* Execute job
*
* @param array $eventData
* @param string $eventName
*/
public function execute(array $eventData, $eventName)
{
if (! empty($eventData['mention'])) {
$this->userNotificationModel->sendUserNotification($eventData['mention'], $eventName, $eventData);
} else {
$this->userNotificationModel->sendNotifications($eventName, $eventData);
$this->projectNotificationModel->sendNotifications($eventData['task']['project_id'], $eventName, $eventData);
}
}
}
|