-
Notifications
You must be signed in to change notification settings - Fork 453
/
UserDeactivatedNotification.php
75 lines (67 loc) · 1.62 KB
/
UserDeactivatedNotification.php
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
namespace Concrete\Core\Entity\Notification;
use Concrete\Core\Notification\View\UserDeactivatedListView;
use Concrete\Core\User\Event\DeactivateUser;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(
* name="UserDeactivatedNotifications"
* )
*/
class UserDeactivatedNotification extends Notification
{
/**
* The user that is being deactivated.
*
* @ORM\Column(type="integer", options={"unsigned": true})
*
* @var int
*/
protected $userID;
/**
* The user doing the deactivating.
*
* @ORM\Column(type="integer", nullable=true, options={"unsigned": true})
*
* @var int|null
*/
protected $actorID;
public function __construct(DeactivateUser $event)
{
$this->userID = $event->getUserEntity()->getUserID();
$actor = $event->getActorEntity();
if ($actor) {
$this->actorID = $event->getActorEntity()->getUserID();
}
parent::__construct($event);
}
/**
* {@inheritdoc}
*
* @see \Concrete\Core\Entity\Notification\Notification::getListView()
*/
public function getListView()
{
/** @todo Replace this with something that enables autowiring */
return new UserDeactivatedListView($this);
}
/**
* Get the deactivated user id.
*
* @return int
*/
public function getUserID()
{
return $this->userID;
}
/**
* Get the user id of the user that triggered deactivation, if available.
*
* @return int|null
*/
public function getActorID()
{
return $this->actorID;
}
}