1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of Jitamin. |
5
|
|
|
* |
6
|
|
|
* Copyright (C) Jitamin Team |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Jitamin\Bus\Subscriber; |
13
|
|
|
|
14
|
|
|
use Jitamin\Bus\Event\GenericEvent; |
15
|
|
|
use Jitamin\Model\CommentModel; |
16
|
|
|
use Jitamin\Model\SubtaskModel; |
17
|
|
|
use Jitamin\Model\TaskFileModel; |
18
|
|
|
use Jitamin\Model\TaskLinkModel; |
19
|
|
|
use Jitamin\Model\TaskModel; |
20
|
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Notification Subscriber. |
24
|
|
|
*/ |
25
|
|
|
class NotificationSubscriber extends BaseSubscriber implements EventSubscriberInterface |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* Get event listeners. |
29
|
|
|
* |
30
|
|
|
* @static |
31
|
|
|
* |
32
|
|
|
* @return array |
33
|
|
|
*/ |
34
|
|
|
public static function getSubscribedEvents() |
35
|
|
|
{ |
36
|
|
|
return [ |
37
|
|
|
TaskModel::EVENT_USER_MENTION => 'handleEvent', |
38
|
|
|
TaskModel::EVENT_CREATE => 'handleEvent', |
39
|
|
|
TaskModel::EVENT_UPDATE => 'handleEvent', |
40
|
|
|
TaskModel::EVENT_CLOSE => 'handleEvent', |
41
|
|
|
TaskModel::EVENT_OPEN => 'handleEvent', |
42
|
|
|
TaskModel::EVENT_MOVE_COLUMN => 'handleEvent', |
43
|
|
|
TaskModel::EVENT_MOVE_POSITION => 'handleEvent', |
44
|
|
|
TaskModel::EVENT_MOVE_SWIMLANE => 'handleEvent', |
45
|
|
|
TaskModel::EVENT_ASSIGNEE_CHANGE => 'handleEvent', |
46
|
|
|
SubtaskModel::EVENT_CREATE => 'handleEvent', |
47
|
|
|
SubtaskModel::EVENT_UPDATE => 'handleEvent', |
48
|
|
|
SubtaskModel::EVENT_DELETE => 'handleEvent', |
49
|
|
|
CommentModel::EVENT_CREATE => 'handleEvent', |
50
|
|
|
CommentModel::EVENT_UPDATE => 'handleEvent', |
51
|
|
|
CommentModel::EVENT_DELETE => 'handleEvent', |
52
|
|
|
CommentModel::EVENT_USER_MENTION => 'handleEvent', |
53
|
|
|
TaskFileModel::EVENT_CREATE => 'handleEvent', |
54
|
|
|
TaskLinkModel::EVENT_CREATE_UPDATE => 'handleEvent', |
55
|
|
|
TaskLinkModel::EVENT_DELETE => 'handleEvent', |
56
|
|
|
]; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Handle the event. |
61
|
|
|
* |
62
|
|
|
* @param GenericEvent $event |
63
|
|
|
* @param string $eventName |
64
|
|
|
*/ |
65
|
|
|
public function handleEvent(GenericEvent $event, $eventName) |
66
|
|
|
{ |
67
|
|
|
$this->logger->debug('Subscriber executed: '.__METHOD__); |
|
|
|
|
68
|
|
|
$this->queueManager->push($this->notificationJob->withParams($event, $eventName)); |
|
|
|
|
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.