src/Entity/AvailabilityTracker.php line 9

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AvailabilityTrackerRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClass: AvailabilityTrackerRepository::class)]
  6. class AvailabilityTracker
  7. {
  8. #[ORM\Id]
  9. #[ORM\GeneratedValue]
  10. #[ORM\Column(type: 'integer')]
  11. private $id;
  12. #[ORM\ManyToOne(targetEntity: Products::class, inversedBy: 'availabilityTrackers')]
  13. private $product;
  14. #[ORM\ManyToOne(targetEntity: Clinics::class, inversedBy: 'availabilityTrackers')]
  15. private $clinic;
  16. #[ORM\Column(type: 'boolean')]
  17. private $isSent;
  18. #[ORM\Column(type: 'datetime')]
  19. private $modified;
  20. #[ORM\Column(type: 'datetime')]
  21. private $created;
  22. #[ORM\ManyToOne(targetEntity: Distributors::class, inversedBy: 'availabilityTrackers')]
  23. private $distributor;
  24. #[ORM\ManyToOne(targetEntity: ClinicCommunicationMethods::class, inversedBy: 'availabilityTrackers')]
  25. private $communication;
  26. #[ORM\OneToOne(targetEntity: Notifications::class, mappedBy: 'availabilityTracker', cascade: ['persist', 'remove'])]
  27. private $notifications;
  28. public function __construct()
  29. {
  30. $date = new \DateTime("now", new \DateTimeZone('Asia/Dubai'));
  31. $this->setModified($date);
  32. if ($this->getCreated() == null)
  33. {
  34. $this->setCreated($date);
  35. }
  36. }
  37. public function getId(): ?int
  38. {
  39. return $this->id;
  40. }
  41. public function getProduct(): ?Products
  42. {
  43. return $this->product;
  44. }
  45. public function setProduct(?Products $product): self
  46. {
  47. $this->product = $product;
  48. return $this;
  49. }
  50. public function getClinic(): ?Clinics
  51. {
  52. return $this->clinic;
  53. }
  54. public function setClinic(?Clinics $clinic): self
  55. {
  56. $this->clinic = $clinic;
  57. return $this;
  58. }
  59. public function getIsSent(): ?bool
  60. {
  61. return $this->isSent;
  62. }
  63. public function setIsSent(bool $isSent): self
  64. {
  65. $this->isSent = $isSent;
  66. return $this;
  67. }
  68. public function getModified(): ?\DateTimeInterface
  69. {
  70. return $this->modified;
  71. }
  72. public function setModified(\DateTimeInterface $modified): self
  73. {
  74. $this->modified = $modified;
  75. return $this;
  76. }
  77. public function getCreated(): ?\DateTimeInterface
  78. {
  79. return $this->created;
  80. }
  81. public function setCreated(\DateTimeInterface $created): self
  82. {
  83. $this->created = $created;
  84. return $this;
  85. }
  86. public function getDistributor(): ?Distributors
  87. {
  88. return $this->distributor;
  89. }
  90. public function setDistributor(?Distributors $distributor): self
  91. {
  92. $this->distributor = $distributor;
  93. return $this;
  94. }
  95. public function getCommunication(): ?ClinicCommunicationMethods
  96. {
  97. return $this->communication;
  98. }
  99. public function setCommunication(?ClinicCommunicationMethods $communication): self
  100. {
  101. $this->communication = $communication;
  102. return $this;
  103. }
  104. public function getNotifications(): ?Notifications
  105. {
  106. return $this->notifications;
  107. }
  108. public function setNotifications(?Notifications $notifications): self
  109. {
  110. // unset the owning side of the relation if necessary
  111. if ($notifications === null && $this->notifications !== null) {
  112. $this->notifications->setAvailabilityTracker(null);
  113. }
  114. // set the owning side of the relation if necessary
  115. if ($notifications !== null && $notifications->getAvailabilityTracker() !== $this) {
  116. $notifications->setAvailabilityTracker($this);
  117. }
  118. $this->notifications = $notifications;
  119. return $this;
  120. }
  121. }