src/Entity/NotificationType.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\NotificationTypeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassNotificationTypeRepository::class)]
  8. class NotificationType
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $label null;
  16.     #[ORM\OneToMany(mappedBy'notificationType'targetEntityNotificationSetting::class)]
  17.     private Collection $notificationSettings;
  18.     #[ORM\Column(length50)]
  19.     private ?string $type null;
  20.     #[ORM\OneToOne(mappedBy'type'cascade: ['persist''remove'])]
  21.     private ?NotificationTemplate $notificationTemplate null;
  22.     public function __construct()
  23.     {
  24.         $this->notificationSettings = new ArrayCollection();
  25.     }
  26.     public function getId(): ?int
  27.     {
  28.         return $this->id;
  29.     }
  30.     public function getLabel(): ?string
  31.     {
  32.         return $this->label;
  33.     }
  34.     public function setLabel(string $label): self
  35.     {
  36.         $this->label $label;
  37.         return $this;
  38.     }
  39.     /**
  40.      * @return Collection<int, NotificationSetting>
  41.      */
  42.     public function getNotificationSettings(): Collection
  43.     {
  44.         return $this->notificationSettings;
  45.     }
  46.     public function addNotificationSetting(NotificationSetting $notificationSetting): self
  47.     {
  48.         if (!$this->notificationSettings->contains($notificationSetting)) {
  49.             $this->notificationSettings->add($notificationSetting);
  50.             $notificationSetting->setNotificationType($this);
  51.         }
  52.         return $this;
  53.     }
  54.     public function removeNotificationSetting(NotificationSetting $notificationSetting): self
  55.     {
  56.         if ($this->notificationSettings->removeElement($notificationSetting)) {
  57.             // set the owning side to null (unless already changed)
  58.             if ($notificationSetting->getNotificationType() === $this) {
  59.                 $notificationSetting->setNotificationType(null);
  60.             }
  61.         }
  62.         return $this;
  63.     }
  64.     public function getType(): ?string
  65.     {
  66.         return $this->type;
  67.     }
  68.     public function setType(string $type): self
  69.     {
  70.         $this->type $type;
  71.         return $this;
  72.     }
  73.     public function getNotificationTemplate(): ?NotificationTemplate
  74.     {
  75.         return $this->notificationTemplate;
  76.     }
  77.     public function setNotificationTemplate(NotificationTemplate $notificationTemplate): self
  78.     {
  79.         // set the owning side of the relation if necessary
  80.         if ($notificationTemplate->getType() !== $this) {
  81.             $notificationTemplate->setType($this);
  82.         }
  83.         $this->notificationTemplate $notificationTemplate;
  84.         return $this;
  85.     }
  86. }