/
UserSignup.php
69 lines (59 loc) · 1.54 KB
/
UserSignup.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
<?php
namespace Concrete\Core\Entity\User;
use Concrete\Core\Notification\Subject\SubjectInterface;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(
* name="UserSignups"
* )
*/
class UserSignup implements SubjectInterface
{
/**
* @ORM\Id @ORM\Column(type="integer", options={"unsigned":true})
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $usID;
/**
* @ORM\OneToOne(targetEntity="\Concrete\Core\Entity\User\User", inversedBy="signup"),
* @ORM\JoinColumn(name="uID", referencedColumnName="uID")
*/
protected $user;
/**
* @ORM\OneToMany(targetEntity="\Concrete\Core\Entity\Notification\UserSignupNotification", mappedBy="signup", cascade={"remove"}),
*/
protected $notifications;
/**
* @ORM\ManyToOne(targetEntity="\Concrete\Core\Entity\User\User"),
* @ORM\JoinColumn(name="createdBy", referencedColumnName="uID")
*/
protected $createdBy;
public function __construct(User $user, User $createdBy = null)
{
$this->user = $user;
$this->createdBy = $createdBy;
}
/**
* @return mixed
*/
public function getUser()
{
return $this->user;
}
public function getNotificationDate()
{
return $this->user->getUserDateAdded();
}
/**
* @return mixed
*/
public function getCreatedBy()
{
return $this->createdBy;
}
public function getUsersToExcludeFromNotification()
{
return is_object($this->createdBy) ? [$this->createdBy] : [];
}
}