|
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\TaskModel; |
|
16
|
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Project modification date Subscriber. |
|
20
|
|
|
*/ |
|
21
|
|
|
class ProjectModificationDateSubscriber extends BaseSubscriber implements EventSubscriberInterface |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* Get event listeners. |
|
25
|
|
|
* |
|
26
|
|
|
* @static |
|
27
|
|
|
* |
|
28
|
|
|
* @return array |
|
29
|
|
|
*/ |
|
30
|
|
|
public static function getSubscribedEvents() |
|
31
|
|
|
{ |
|
32
|
|
|
return [ |
|
33
|
|
|
TaskModel::EVENT_CREATE_UPDATE => 'execute', |
|
34
|
|
|
TaskModel::EVENT_CLOSE => 'execute', |
|
35
|
|
|
TaskModel::EVENT_OPEN => 'execute', |
|
36
|
|
|
TaskModel::EVENT_MOVE_SWIMLANE => 'execute', |
|
37
|
|
|
TaskModel::EVENT_MOVE_COLUMN => 'execute', |
|
38
|
|
|
TaskModel::EVENT_MOVE_POSITION => 'execute', |
|
39
|
|
|
TaskModel::EVENT_MOVE_PROJECT => 'execute', |
|
40
|
|
|
TaskModel::EVENT_ASSIGNEE_CHANGE => 'execute', |
|
41
|
|
|
]; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Handle the event. |
|
46
|
|
|
* |
|
47
|
|
|
* @param GenericEvent $event |
|
48
|
|
|
*/ |
|
49
|
|
|
public function execute(GenericEvent $event) |
|
50
|
|
|
{ |
|
51
|
|
|
$this->logger->debug('Subscriber executed: '.__METHOD__); |
|
|
|
|
|
|
52
|
|
|
$this->projectModel->updateModificationDate($event['task']['project_id']); |
|
|
|
|
|
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|
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@propertyannotation 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.