id = $id; $this->login = $login; $this->name = $name; $this->createdAt = $createdAt ?: new \DateTime(); $this->subscribers = new ArrayCollection(); $this->subscriptions = new ArrayCollection(); $this->newSubscriberEvents = new ArrayCollection(); } /** * @ORM\PreUpdate */ public function preUpdate(): void { $this->updatedAt = new \DateTime(); } public function getId(): int { return $this->id; } public function getLogin(): string { return $this->login; } public function getName(): ?string { return $this->name; } public function updateLoginAndName(string $login, ?string $name): self { $this->login = $login; $this->name = $name; return $this; } public function addSubscriber(Subscription $subscribers): self { $this->subscribers[] = $subscribers; return $this; } public function removeSubscriber(Subscription $subscribers) { $this->subscribers->removeElement($subscribers); } /** * @return Subscription[]|ArrayCollection */ public function getSubscribers(): iterable { return $this->subscribers; } /** * @return Subscription[]|ArrayCollection */ public function getSubscriptions(): iterable { return $this->subscriptions; } public function addNewSubscriberEvent(SubscriptionEvent $newSubscriberEvents): self { $this->newSubscriberEvents[] = $newSubscriberEvents; return $this; } /** * @return SubscriptionEvent[]|ArrayCollection */ public function getNewSubscriberEvents(): iterable { return $this->newSubscriberEvents; } public function getCreatedAt(): \DateTime { return $this->createdAt; } public function getUpdatedAt(): ?\DateTime { return $this->updatedAt; } public function updatePrivacy(?bool $public, ?bool $whitelistOnly): void { $this->public = $public; $this->whitelistOnly = $whitelistOnly; } public function isPublic(): ?bool { return $this->public; } public function isWhitelistOnly(): ?bool { return $this->whitelistOnly; } public function isRemoved(): bool { return $this->removed; } public function markAsRemoved(): void { $this->removed = true; } public function restore(): void { $this->removed = false; } }