src/Entity/Announcement.php line 13
<?phpnamespace App\Entity;use App\Repository\AnnouncementRepository;use App\Traits\TimeStampTrait;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: AnnouncementRepository::class)]#[ORM\HasLifecycleCallbacks]class Announcement{use TimeStampTrait;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 100)]private ?string $code = null;#[ORM\Column(length: 255)]private ?string $title = null;#[ORM\Column(type: 'text')]private ?string $message = null;#[ORM\Column(nullable: true)]private ?\DateTimeImmutable $sendAt = null;#[ORM\ManyToMany(targetEntity: Locataire::class, inversedBy: 'announcements')]private Collection $locataire;#[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'announcements')]private Collection $user;#[ORM\ManyToOne(inversedBy: 'announcements')]private ?Entreprise $entreprise = null;#[ORM\Column]private ?bool $view = null;#[ORM\Column]private ?bool $sent = null;#[ORM\Column(length: 50, nullable: true)]private ?string $type = null;#[ORM\OneToMany(mappedBy: 'annoucement', targetEntity: NotificationView::class)]private Collection $notificationViews;public function __construct(){$this->locataire = new ArrayCollection();$this->user = new ArrayCollection();$this->notificationViews = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getCode(): ?string{return $this->code;}public function setCode(string $code): static{$this->code = $code;return $this;}public function getTitle(): ?string{return $this->title;}public function setTitle(string $title): static{$this->title = $title;return $this;}public function getMessage(): ?string{return $this->message;}public function setMessage(string $message): static{$this->message = $message;return $this;}public function getSendAt(): ?\DateTimeImmutable{return $this->sendAt;}public function setSendAt(?\DateTimeImmutable $sendAt): static{$this->sendAt = $sendAt;return $this;}/*** @return Collection<int, Locataire>*/public function getLocataire(): Collection{return $this->locataire;}public function addLocataire(Locataire $locataire): static{if (!$this->locataire->contains($locataire)) {$this->locataire->add($locataire);}return $this;}public function removeLocataire(Locataire $locataire): static{$this->locataire->removeElement($locataire);return $this;}/*** @return Collection<int, User>*/public function getUser(): Collection{return $this->user;}public function addUser(User $user): static{if (!$this->user->contains($user)) {$this->user->add($user);}return $this;}public function removeUser(User $user): static{$this->user->removeElement($user);return $this;}public function getEntreprise(): ?Entreprise{return $this->entreprise;}public function setEntreprise(?Entreprise $entreprise): static{$this->entreprise = $entreprise;return $this;}public function isView(): ?bool{return $this->view;}public function setView(bool $view): static{$this->view = $view;return $this;}public function isSent(): ?bool{return $this->sent;}public function setSent(bool $sent): static{$this->sent = $sent;return $this;}public function getType(): ?string{return $this->type;}public function setType(?string $type): static{$this->type = $type;return $this;}/*** @return Collection<int, NotificationView>*/public function getNotificationViews(): Collection{return $this->notificationViews;}public function addNotificationView(NotificationView $notificationView): static{if (!$this->notificationViews->contains($notificationView)) {$this->notificationViews->add($notificationView);$notificationView->setAnnoucement($this);}return $this;}public function removeNotificationView(NotificationView $notificationView): static{if ($this->notificationViews->removeElement($notificationView)) {// set the owning side to null (unless already changed)if ($notificationView->getAnnoucement() === $this) {$notificationView->setAnnoucement(null);}}return $this;}}