src/Entity/MassiveNotification.php line 27

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\MassiveNotificationRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  11. use ApiPlatform\Metadata\ApiFilter;
  12. #[ORM\Entity(repositoryClassMassiveNotificationRepository::class)]
  13. #[ApiResource(
  14.     normalizationContext: ['groups' => ['MassiveNotification:read']],
  15.     denormalizationContext: ['groups' => ['MassiveNotification:write']],
  16.     order: ['id' => 'DESC'],
  17. )]
  18. #[ApiFilter(SearchFilter::class, properties: [
  19.     'userCreated.id' => 'exact',
  20.     'notifications.ns_msg_id' => 'exact',
  21. ])]
  22. class MassiveNotification
  23. {
  24.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  25.     #[ORM\Id]
  26.     #[ORM\GeneratedValue]
  27.     #[ORM\Column]
  28.     private ?int $id null;
  29.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  30.     #[ORM\Column(length255nullabletrue)]
  31.     private ?string $name null;
  32.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  33.     #[ORM\Column(length255nullabletrue)]
  34.     private ?string $title null;
  35.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  36.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  37.     private ?string $body null;
  38.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  39.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  40.     private ?string $description null;
  41.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  42.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  43.     private ?\DateTimeInterface $dateEntered null;
  44.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  45.     #[ORM\Column(length100nullabletrue)]
  46.     private ?string $status null;
  47.     #[Groups(['MassiveNotification:write''Notification:read'])]
  48.     #[ORM\ManyToOne(inversedBy'massiveNotifications')]
  49.     private ?User $userCreated null;
  50.     #[Groups([ 'MassiveNotification:write'])]
  51.     #[ORM\OneToMany(mappedBy'massiveNotification'targetEntityNotification::class)]
  52.     private Collection $notifications;
  53.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  54.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  55.     private ?\DateTimeInterface $plannedTimeSend null;
  56.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  57.     #[ORM\Column(length100nullabletrue)]
  58.     private ?string $type null;
  59.     #[ORM\Column(length100nullabletrue)]
  60.     private ?string $nsMsgId null;
  61.     #[ORM\Column(length100nullabletrue)]
  62.     private ?string $controlId null;
  63.     public function __construct()
  64.     {
  65.         $this->notifications = new ArrayCollection();
  66.     }
  67.     public function getId(): ?int
  68.     {
  69.         return $this->id;
  70.     }
  71.     public function getName(): ?string
  72.     {
  73.         return $this->name;
  74.     }
  75.     public function setName(?string $name): static
  76.     {
  77.         $this->name $name;
  78.         return $this;
  79.     }
  80.     public function getTitle(): ?string
  81.     {
  82.         return $this->title;
  83.     }
  84.     public function setTitle(?string $title): static
  85.     {
  86.         $this->title $title;
  87.         return $this;
  88.     }
  89.     public function getBody(): ?string
  90.     {
  91.         return $this->body;
  92.     }
  93.     public function setBody(?string $body): static
  94.     {
  95.         $this->body $body;
  96.         return $this;
  97.     }
  98.     public function getDescription(): ?string
  99.     {
  100.         return $this->description;
  101.     }
  102.     public function setDescription(?string $description): static
  103.     {
  104.         $this->description $description;
  105.         return $this;
  106.     }
  107.     public function getDateEntered(): ?\DateTimeInterface
  108.     {
  109.         return $this->dateEntered;
  110.     }
  111.     public function setDateEntered(?\DateTimeInterface $dateEntered): static
  112.     {
  113.         $this->dateEntered $dateEntered;
  114.         return $this;
  115.     }
  116.     public function getStatus(): ?string
  117.     {
  118.         return $this->status;
  119.     }
  120.     public function setStatus(?string $status): static
  121.     {
  122.         $this->status $status;
  123.         return $this;
  124.     }
  125.     public function getUserCreated(): ?User
  126.     {
  127.         return $this->userCreated;
  128.     }
  129.     public function setUserCreated(?User $userCreated): static
  130.     {
  131.         $this->userCreated $userCreated;
  132.         return $this;
  133.     }
  134.     /**
  135.      * @return Collection<int, Notification>
  136.      */
  137.     public function getNotifications(): Collection
  138.     {
  139.         return $this->notifications;
  140.     }
  141.     public function addNotification(Notification $notification): static
  142.     {
  143.         if (!$this->notifications->contains($notification)) {
  144.             $this->notifications->add($notification);
  145.             $notification->setMassiveNotification($this);
  146.         }
  147.         return $this;
  148.     }
  149.     public function removeNotification(Notification $notification): static
  150.     {
  151.         if ($this->notifications->removeElement($notification)) {
  152.             // set the owning side to null (unless already changed)
  153.             if ($notification->getMassiveNotification() === $this) {
  154.                 $notification->setMassiveNotification(null);
  155.             }
  156.         }
  157.         return $this;
  158.     }
  159.     public function getPlannedTimeSend(): ?\DateTimeInterface
  160.     {
  161.         return $this->plannedTimeSend;
  162.     }
  163.     public function setPlannedTimeSend(?\DateTimeInterface $plannedTimeSend): static
  164.     {
  165.         $this->plannedTimeSend $plannedTimeSend;
  166.         return $this;
  167.     }
  168.     public function getType(): ?string
  169.     {
  170.         return $this->type;
  171.     }
  172.     public function setType(?string $type): static
  173.     {
  174.         $this->type $type;
  175.         return $this;
  176.     }
  177.     public function getNsMsgId(): ?string
  178.     {
  179.         return $this->nsMsgId;
  180.     }
  181.     public function setNsMsgId(?string $nsMsgId): static
  182.     {
  183.         $this->nsMsgId $nsMsgId;
  184.         return $this;
  185.     }
  186.     public function getControlId(): ?string
  187.     {
  188.         return $this->controlId;
  189.     }
  190.     public function setControlId(?string $controlId): static
  191.     {
  192.         $this->controlId $controlId;
  193.         return $this;
  194.     }
  195. }