1 | <?php |
||
15 | class SubscriptionEvent |
||
16 | { |
||
17 | public const ACTION_SUBSCRIBE = 'subscribe'; |
||
18 | public const ACTION_UNSUBSCRIBE = 'unsubscribe'; |
||
19 | |||
20 | /** |
||
21 | * @var int |
||
22 | * |
||
23 | * @ORM\Column(name="id", type="integer") |
||
24 | * @ORM\Id |
||
25 | * @ORM\GeneratedValue(strategy="AUTO") |
||
26 | */ |
||
27 | private $id; |
||
28 | |||
29 | /** |
||
30 | * @var User Blog author |
||
31 | * |
||
32 | * @ORM\ManyToOne(targetEntity="User", inversedBy="newSubscriberEvents") |
||
33 | * @ORM\JoinColumn(name="author_id", nullable=false) |
||
34 | */ |
||
35 | private $author; |
||
36 | |||
37 | /** |
||
38 | * @var User Blog subscriber |
||
39 | * |
||
40 | * @ORM\ManyToOne(targetEntity="User") |
||
41 | * @ORM\JoinColumn(name="subscriber_id", nullable=false) |
||
42 | */ |
||
43 | private $subscriber; |
||
44 | |||
45 | /** |
||
46 | * @var \DateTime |
||
47 | * |
||
48 | * @ORM\Column(name="date", type="datetime", nullable=false) |
||
49 | */ |
||
50 | private $date; |
||
51 | |||
52 | /** |
||
53 | * @var string |
||
54 | * |
||
55 | * @ORM\Column(name="action", type="string", length=12, nullable=false) |
||
56 | */ |
||
57 | private $action; |
||
58 | |||
59 | |||
60 | public function __construct(User $author, User $subscriber, string $action = self::ACTION_SUBSCRIBE) |
||
67 | |||
68 | public function getId(): int |
||
72 | |||
73 | public function getDate(): \DateTime |
||
77 | |||
78 | 5 | public function getSubscriber(): User |
|
82 | |||
83 | 5 | public function getAuthor(): User |
|
87 | |||
88 | 2 | public function getAction(): string |
|
92 | } |
||
93 |