src/Entity/InAppAnnouncement.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\InAppAnnouncementRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassInAppAnnouncementRepository::class)]
  8. class InAppAnnouncement
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255)]
  15.     private $targetKey;
  16.     #[ORM\Column(type'string'length255)]
  17.     private $title;
  18.     #[ORM\Column(type'string'length255)]
  19.     private $message;
  20.     #[ORM\Column(type'string'length255)]
  21.     private $sourceHash;
  22.     #[ORM\Column(type'datetime_immutable')]
  23.     private $createdAt;
  24.     #[ORM\Column(type'boolean')]
  25.     private $active;
  26.     #[ORM\Column(type'integer'options: ['default' => 0])]
  27.     private $priority;
  28.     #[ORM\OneToMany(mappedBy'announcement'targetEntityInAppAnnouncementUser::class, orphanRemovaltrue)]
  29.     private $inAppAnnouncementUsers;
  30.     #[ORM\Column(type'json'nullabletrue)]
  31.     private $allowedRoles = [];
  32.     public function __construct()
  33.     {
  34.         $this->inAppAnnouncementUsers = new ArrayCollection();
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getTargetKey(): ?string
  41.     {
  42.         return $this->targetKey;
  43.     }
  44.     public function setTargetKey(string $targetKey): self
  45.     {
  46.         $this->targetKey $targetKey;
  47.         return $this;
  48.     }
  49.     public function getTitle(): ?string
  50.     {
  51.         return $this->title;
  52.     }
  53.     public function setTitle(string $title): self
  54.     {
  55.         $this->title $title;
  56.         return $this;
  57.     }
  58.     public function getMessage(): ?string
  59.     {
  60.         return $this->message;
  61.     }
  62.     public function setMessage(string $message): self
  63.     {
  64.         $this->message $message;
  65.         return $this;
  66.     }
  67.     public function getSourceHash(): ?string
  68.     {
  69.         return $this->sourceHash;
  70.     }
  71.     public function setSourceHash(string $sourceHash): self
  72.     {
  73.         $this->sourceHash $sourceHash;
  74.         return $this;
  75.     }
  76.     public function getCreatedAt(): ?\DateTimeImmutable
  77.     {
  78.         return $this->createdAt;
  79.     }
  80.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  81.     {
  82.         $this->createdAt $createdAt;
  83.         return $this;
  84.     }
  85.     public function isActive(): ?bool
  86.     {
  87.         return $this->active;
  88.     }
  89.     public function setActive(bool $active): self
  90.     {
  91.         $this->active $active;
  92.         return $this;
  93.     }
  94.     public function getPriority(): ?int
  95.     {
  96.         return $this->priority;
  97.     }
  98.     public function setPriority(int $priority): self
  99.     {
  100.         $this->priority $priority;
  101.         return $this;
  102.     }
  103.     /**
  104.      * @return Collection<int, InAppAnnouncementUser>
  105.      */
  106.     public function getInAppAnnouncementUsers(): Collection
  107.     {
  108.         return $this->inAppAnnouncementUsers;
  109.     }
  110.     public function addInAppAnnouncementUser(InAppAnnouncementUser $inAppAnnouncementUser): self
  111.     {
  112.         if (!$this->inAppAnnouncementUsers->contains($inAppAnnouncementUser)) {
  113.             $this->inAppAnnouncementUsers[] = $inAppAnnouncementUser;
  114.             $inAppAnnouncementUser->setAnnouncement($this);
  115.         }
  116.         return $this;
  117.     }
  118.     public function removeInAppAnnouncementUser(InAppAnnouncementUser $inAppAnnouncementUser): self
  119.     {
  120.         if ($this->inAppAnnouncementUsers->removeElement($inAppAnnouncementUser)) {
  121.             // set the owning side to null (unless already changed)
  122.             if ($inAppAnnouncementUser->getAnnouncement() === $this) {
  123.                 $inAppAnnouncementUser->setAnnouncement(null);
  124.             }
  125.         }
  126.         return $this;
  127.     }
  128.     public function getAllowedRoles(): ?array
  129.     {
  130.         return $this->allowedRoles;
  131.     }
  132.     public function setAllowedRoles(?array $allowedRoles): self
  133.     {
  134.         $this->allowedRoles $allowedRoles;
  135.         return $this;
  136.     }
  137. }