-
Notifications
You must be signed in to change notification settings - Fork 452
/
GroupSignup.php
149 lines (129 loc) · 2.98 KB
/
GroupSignup.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php
namespace Concrete\Core\Entity\User;
use Concrete\Core\Notification\Subject\SubjectInterface;
use Concrete\Core\User\Group\Group;
use Concrete\Core\User\UserInfo;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(
* name="GroupSignups"
* )
*/
class GroupSignup implements SubjectInterface
{
/**
* @var int
* @ORM\Id
* @ORM\Column(type="integer", options={"unsigned":true})
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var int
* @ORM\OneToMany(targetEntity="\Concrete\Core\Entity\Notification\GroupSignupNotification", mappedBy="signup", cascade={"remove"}),
*/
protected $notifications;
/**
* @var int
* @ORM\Column(type="integer", options={"unsigned":true})
*/
protected $gID;
/**
* @var User
* @ORM\ManyToOne(targetEntity="\Concrete\Core\Entity\User\User")
* @ORM\JoinColumn(name="uID", referencedColumnName="uID", onDelete="SET NULL")
*/
protected $user;
/**
* @var \DateTime
* @ORM\Column(type="datetime")
*/
protected $requested = null;
/**
* GroupSignupRequest constructor.
* @param Group $group
* @param \Concrete\Core\User\User $user
* @throws \Exception
*/
public function __construct($group = null, $user = null)
{
if ($group instanceof Group) {
$this->gID = $group->getGroupID();
}
if ($user instanceof \Concrete\Core\User\User) {
if ($user->getUserInfoObject() instanceof UserInfo) {
$this->user = $user->getUserInfoObject()->getEntityObject();
}
}
$this->requested = new \DateTime();
}
/**
* @return Group
*/
public function getGroup()
{
return Group::getByID($this->getGID());
}
/**
* @return int
*/
public function getGID(): int
{
return $this->gID;
}
/**
* @param int $gID
* @return GroupSignup
*/
public function setGID(int $gID): GroupSignup
{
$this->gID = $gID;
return $this;
}
/**
* @return User
*/
public function getUser(): User
{
return $this->user;
}
/**
* @param User $user
* @return GroupSignup
*/
public function setUser(User $user): GroupSignup
{
$this->user = $user;
return $this;
}
/**
* @return \DateTime
*/
public function getRequested(): \DateTime
{
return $this->requested;
}
/**
* @param \DateTime $requested
* @return GroupSignup
*/
public function setRequested(\DateTime $requested): GroupSignup
{
$this->requested = $requested;
return $this;
}
/**
* Get the date of this notification
*
* @return \DateTime
*/
public function getNotificationDate()
{
return $this->requested;
}
public function getUsersToExcludeFromNotification()
{
return [];
}
}