<?phpnamespace App\Entity;use App\Repository\InAppAnnouncementRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: InAppAnnouncementRepository::class)]class InAppAnnouncement{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; #[ORM\Column(type: 'string', length: 255)] private $targetKey; #[ORM\Column(type: 'string', length: 255)] private $title; #[ORM\Column(type: 'string', length: 255)] private $message; #[ORM\Column(type: 'string', length: 255)] private $sourceHash; #[ORM\Column(type: 'datetime_immutable')] private $createdAt; #[ORM\Column(type: 'boolean')] private $active; #[ORM\Column(type: 'integer', options: ['default' => 0])] private $priority; #[ORM\OneToMany(mappedBy: 'announcement', targetEntity: InAppAnnouncementUser::class, orphanRemoval: true)] private $inAppAnnouncementUsers; #[ORM\Column(type: 'json', nullable: true)] private $allowedRoles = []; public function __construct() { $this->inAppAnnouncementUsers = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getTargetKey(): ?string { return $this->targetKey; } public function setTargetKey(string $targetKey): self { $this->targetKey = $targetKey; return $this; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getMessage(): ?string { return $this->message; } public function setMessage(string $message): self { $this->message = $message; return $this; } public function getSourceHash(): ?string { return $this->sourceHash; } public function setSourceHash(string $sourceHash): self { $this->sourceHash = $sourceHash; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(\DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function isActive(): ?bool { return $this->active; } public function setActive(bool $active): self { $this->active = $active; return $this; } public function getPriority(): ?int { return $this->priority; } public function setPriority(int $priority): self { $this->priority = $priority; return $this; } /** * @return Collection<int, InAppAnnouncementUser> */ public function getInAppAnnouncementUsers(): Collection { return $this->inAppAnnouncementUsers; } public function addInAppAnnouncementUser(InAppAnnouncementUser $inAppAnnouncementUser): self { if (!$this->inAppAnnouncementUsers->contains($inAppAnnouncementUser)) { $this->inAppAnnouncementUsers[] = $inAppAnnouncementUser; $inAppAnnouncementUser->setAnnouncement($this); } return $this; } public function removeInAppAnnouncementUser(InAppAnnouncementUser $inAppAnnouncementUser): self { if ($this->inAppAnnouncementUsers->removeElement($inAppAnnouncementUser)) { // set the owning side to null (unless already changed) if ($inAppAnnouncementUser->getAnnouncement() === $this) { $inAppAnnouncementUser->setAnnouncement(null); } } return $this; } public function getAllowedRoles(): ?array { return $this->allowedRoles; } public function setAllowedRoles(?array $allowedRoles): self { $this->allowedRoles = $allowedRoles; return $this; }}