1 | <?php |
||
13 | class User |
||
14 | { |
||
15 | const AVATAR_SIZE_SMALL = '24'; |
||
16 | const AVATAR_SIZE_MEDIUM = '40'; |
||
17 | const AVATAR_SIZE_LARGE = '80'; |
||
18 | |||
19 | /** |
||
20 | * @var int |
||
21 | * |
||
22 | * @ORM\Column(name="id", type="integer") |
||
23 | * @ORM\Id |
||
24 | */ |
||
25 | private $id; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | * |
||
30 | * @ORM\Column(name="login", type="string", length=255, nullable=false) |
||
31 | */ |
||
32 | private $login; |
||
33 | |||
34 | /** |
||
35 | * @var string|null |
||
36 | * |
||
37 | * @ORM\Column(name="name", type="string", length=255, nullable=true) |
||
38 | */ |
||
39 | private $name; |
||
40 | |||
41 | /** |
||
42 | * @var \DateTime |
||
43 | * |
||
44 | * @ORM\Column(name="created_at", type="datetime") |
||
45 | */ |
||
46 | private $createdAt; |
||
47 | |||
48 | /** |
||
49 | * @var \DateTime |
||
50 | * |
||
51 | * @ORM\Column(name="updated_at", type="datetime", nullable=true) |
||
52 | */ |
||
53 | private $updatedAt; |
||
54 | |||
55 | /** |
||
56 | * @var ArrayCollection|Subscription[] |
||
57 | * |
||
58 | * @ORM\OneToMany(targetEntity="Subscription", mappedBy="author", fetch="EXTRA_LAZY") |
||
59 | */ |
||
60 | private $subscribers; |
||
61 | |||
62 | /** |
||
63 | * @var ArrayCollection|Subscription[] |
||
64 | * |
||
65 | * @ORM\OneToMany(targetEntity="Subscription", mappedBy="subscriber", fetch="EXTRA_LAZY") |
||
66 | */ |
||
67 | private $subscriptions; |
||
68 | |||
69 | /** |
||
70 | * @var ArrayCollection|SubscriptionEvent[] |
||
71 | * |
||
72 | * @ORM\OneToMany(targetEntity="SubscriptionEvent", mappedBy="author", fetch="EXTRA_LAZY") |
||
73 | */ |
||
74 | private $newSubscriberEvents; |
||
75 | |||
76 | /** |
||
77 | * @var bool |
||
78 | * |
||
79 | * @ORM\Column(name="is_removed", type="boolean", options={"default": false}) |
||
80 | */ |
||
81 | private $removed = false; |
||
82 | |||
83 | |||
84 | public function __construct(int $id, \DateTime $createdAt = null, string $login = null, string $name = null) |
||
95 | |||
96 | /** |
||
97 | * @ORM\PreUpdate |
||
98 | */ |
||
99 | public function preUpdate(): void |
||
103 | |||
104 | public function getId(): int |
||
108 | 3 | ||
109 | |||
110 | public function getLogin(): string |
||
114 | |||
115 | public function getName(): ?string |
||
119 | |||
120 | public function updateLoginAndName(string $login, ?string $name): self |
||
127 | |||
128 | public function addSubscriber(Subscription $subscribers): self |
||
134 | 1 | ||
135 | public function removeSubscriber(Subscription $subscribers) |
||
139 | |||
140 | /** |
||
141 | * @return Subscription[]|ArrayCollection |
||
142 | */ |
||
143 | public function getSubscribers(): iterable |
||
147 | |||
148 | /** |
||
149 | * @return Subscription[]|ArrayCollection |
||
150 | */ |
||
151 | public function getSubscriptions(): iterable |
||
155 | |||
156 | public function addNewSubscriberEvent(SubscriptionEvent $newSubscriberEvents): self |
||
162 | |||
163 | /** |
||
164 | * @return SubscriptionEvent[]|ArrayCollection |
||
165 | */ |
||
166 | public function getNewSubscriberEvents(): iterable |
||
170 | |||
171 | public function getCreatedAt(): \DateTime |
||
175 | |||
176 | public function getUpdatedAt(): ?\DateTime |
||
180 | |||
181 | public function isRemoved(): bool |
||
185 | |||
186 | public function markAsRemoved(): void |
||
190 | |||
191 | public function restore(): void |
||
195 | } |
||
196 |