id = $id; $this->login = $login; $this->name = $name; $this->subscribers = new ArrayCollection(); $this->subscriptions = new ArrayCollection(); $this->newSubscriberEvents = new ArrayCollection(); } /** * @ORM\PrePersist */ public function onCreate() { if (!$this->createdAt) { $this->createdAt = new \DateTime(); } } /** * @ORM\PreUpdate */ public function preUpdate() { $this->updatedAt = new \DateTime(); } public function getId(): int { return $this->id; } /** * @param string $login * @return User */ public function setLogin(string $login): self { $this->login = $login; return $this; } public function getLogin(): string { return $this->login; } public function setName(string $name = null): self { $this->name = $name; return $this; } public function getName() { return $this->name; } 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() { return $this->subscribers; } /** * @return Subscription[]|ArrayCollection */ public function getSubscriptions() { return $this->subscriptions; } public function addNewSubscriberEvent(SubscriptionEvent $newSubscriberEvents): self { $this->newSubscriberEvents[] = $newSubscriberEvents; return $this; } /** * @return SubscriptionEvent[]|ArrayCollection */ public function getNewSubscriberEvents() { return $this->newSubscriberEvents; } public function getCreatedAt(): \DateTime { return $this->createdAt; } public function setCreatedAt(\DateTime $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): \DateTime { return $this->updatedAt; } }