src/Entity/MassiveNotification.php line 26

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. ])]
  21. class MassiveNotification
  22. {
  23.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  24.     #[ORM\Id]
  25.     #[ORM\GeneratedValue]
  26.     #[ORM\Column]
  27.     private ?int $id null;
  28.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  29.     #[ORM\Column(length255nullabletrue)]
  30.     private ?string $name null;
  31.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  32.     #[ORM\Column(length255nullabletrue)]
  33.     private ?string $title null;
  34.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  35.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  36.     private ?string $body null;
  37.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  38.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  39.     private ?string $description null;
  40.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  41.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  42.     private ?\DateTimeInterface $dateEntered null;
  43.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  44.     #[ORM\Column(length100nullabletrue)]
  45.     private ?string $status null;
  46.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  47.     #[ORM\ManyToOne(inversedBy'massiveNotifications')]
  48.     private ?User $userCreated null;
  49.     #[Groups(['MassiveNotification:read''MassiveNotification:write'])]
  50.     #[ORM\OneToMany(mappedBy'massiveNotification'targetEntityNotification::class)]
  51.     private Collection $notifications;
  52.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  53.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  54.     private ?\DateTimeInterface $plannedTimeSend null;
  55.     #[Groups(['MassiveNotification:read''MassiveNotification:write''Notification:read'])]
  56.     #[ORM\Column(length100nullabletrue)]
  57.     private ?string $type null;
  58.     public function __construct()
  59.     {
  60.         $this->notifications = new ArrayCollection();
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getName(): ?string
  67.     {
  68.         return $this->name;
  69.     }
  70.     public function setName(?string $name): static
  71.     {
  72.         $this->name $name;
  73.         return $this;
  74.     }
  75.     public function getTitle(): ?string
  76.     {
  77.         return $this->title;
  78.     }
  79.     public function setTitle(?string $title): static
  80.     {
  81.         $this->title $title;
  82.         return $this;
  83.     }
  84.     public function getBody(): ?string
  85.     {
  86.         return $this->body;
  87.     }
  88.     public function setBody(?string $body): static
  89.     {
  90.         $this->body $body;
  91.         return $this;
  92.     }
  93.     public function getDescription(): ?string
  94.     {
  95.         return $this->description;
  96.     }
  97.     public function setDescription(?string $description): static
  98.     {
  99.         $this->description $description;
  100.         return $this;
  101.     }
  102.     public function getDateEntered(): ?\DateTimeInterface
  103.     {
  104.         return $this->dateEntered;
  105.     }
  106.     public function setDateEntered(?\DateTimeInterface $dateEntered): static
  107.     {
  108.         $this->dateEntered $dateEntered;
  109.         return $this;
  110.     }
  111.     public function getStatus(): ?string
  112.     {
  113.         return $this->status;
  114.     }
  115.     public function setStatus(?string $status): static
  116.     {
  117.         $this->status $status;
  118.         return $this;
  119.     }
  120.     public function getUserCreated(): ?User
  121.     {
  122.         return $this->userCreated;
  123.     }
  124.     public function setUserCreated(?User $userCreated): static
  125.     {
  126.         $this->userCreated $userCreated;
  127.         return $this;
  128.     }
  129.     /**
  130.      * @return Collection<int, Notification>
  131.      */
  132.     public function getNotifications(): Collection
  133.     {
  134.         return $this->notifications;
  135.     }
  136.     public function addNotification(Notification $notification): static
  137.     {
  138.         if (!$this->notifications->contains($notification)) {
  139.             $this->notifications->add($notification);
  140.             $notification->setMassiveNotification($this);
  141.         }
  142.         return $this;
  143.     }
  144.     public function removeNotification(Notification $notification): static
  145.     {
  146.         if ($this->notifications->removeElement($notification)) {
  147.             // set the owning side to null (unless already changed)
  148.             if ($notification->getMassiveNotification() === $this) {
  149.                 $notification->setMassiveNotification(null);
  150.             }
  151.         }
  152.         return $this;
  153.     }
  154.     public function getPlannedTimeSend(): ?\DateTimeInterface
  155.     {
  156.         return $this->plannedTimeSend;
  157.     }
  158.     public function setPlannedTimeSend(?\DateTimeInterface $plannedTimeSend): static
  159.     {
  160.         $this->plannedTimeSend $plannedTimeSend;
  161.         return $this;
  162.     }
  163.     public function getType(): ?string
  164.     {
  165.         return $this->type;
  166.     }
  167.     public function setType(?string $type): static
  168.     {
  169.         $this->type $type;
  170.         return $this;
  171.     }
  172. }