<?phpnamespace App\Entity;use App\Repository\NotificationRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use DateTime;/** * @ORM\Entity(repositoryClass=NotificationRepository::class) * @ORM\HasLifecycleCallbacks() */class Notification{ public const LEVEL_INFO = 1; public const LEVEL_SUCCESS = 2; public const LEVEL_WARNING = 3; public const LEVEL_ERROR = 99; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $title; /** * @ORM\Column(type="text") */ private $content; /** * @ORM\Column(type="smallint") */ private $level; /** * @ORM\OneToMany(targetEntity=UserNotification::class, mappedBy="notification", cascade={"persist"}) */ private $userNotifications; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="datetime", nullable=true) */ private $updatedAt; /** * @ORM\Column(type="string", length=255) */ private $uid; /** * @ORM\Column(type="boolean") */ private $isTreated = false; /** * @ORM\ManyToOne(targetEntity=User::class) */ private $treatedBy; /** * @ORM\ManyToOne(targetEntity=Job::class, inversedBy="notifications") */ private $job; /** * @ORM\Column(type="integer", nullable=true) */ private $step; public function __construct() { $this->userNotifications = new ArrayCollection(); $this->createdAt = new DateTime(); } /** * @ORM\PreUpdate() */ public function preUpdateAt() { $this->updatedAt = new DateTime(); } public function getId(): ?int { return $this->id; } public function getTitle(): ?string { return $this->title; } /** * @param string|null $title * @return $this */ public function setTitle(?string $title): self { $this->title = $title; return $this; } public function getContent(): ?string { return $this->content; } public function setContent(string $content): self { $this->content = $content; return $this; } public function getLevel(): ?int { return $this->level; } public function setLevel(int $level): self { $this->level = $level; return $this; } /** * @return Collection|UserNotification[] */ public function getUserNotifications(): Collection { return $this->userNotifications; } public function addUserNotification(UserNotification $userNotification): self { if (!$this->userNotifications->contains($userNotification)) { $this->userNotifications[] = $userNotification; $userNotification->setNotification($this); } return $this; } public function removeUserNotification(UserNotification $userNotification): self { if ($this->userNotifications->removeElement($userNotification)) { // set the owning side to null (unless already changed) if ($userNotification->getNotification() === $this) { $userNotification->setNotification(null); } } return $this; } 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; } public function setUpdatedAt(?DateTime $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } public function getUid(): ?string { return $this->uid; } public function setUid(string $uid): self { $this->uid = $uid; return $this; } public function getIsTreated(): ?bool { return $this->isTreated; } public function setIsTreated(bool $isTreated): self { $this->isTreated = $isTreated; return $this; } public function getTreatedBy(): ?User { return $this->treatedBy; } public function setTreatedBy(?User $treatedBy): self { $this->treatedBy = $treatedBy; return $this; } public function getJob(): ?Job { return $this->job; } public function setJob(?Job $job): self { $this->job = $job; return $this; } public function getStep(): ?int { return $this->step; } public function setStep(?int $step): self { $this->step = $step; return $this; }}