src/Entity/DistributorProducts.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DistributorProductsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClass: DistributorProductsRepository::class)]
  8. class DistributorProducts
  9. {
  10. #[ORM\Id]
  11. #[ORM\GeneratedValue]
  12. #[ORM\Column(type: 'integer')]
  13. private $id;
  14. #[ORM\ManyToOne(targetEntity: Distributors::class, inversedBy: 'distributorProducts')]
  15. private $distributor;
  16. #[ORM\ManyToOne(targetEntity: Products::class, inversedBy: 'distributorProducts')]
  17. private $product;
  18. #[ORM\Column(type: 'string', length: 255)]
  19. private $sku;
  20. #[ORM\Column(type: 'float', nullable: true)]
  21. private $unitPrice;
  22. #[ORM\Column(type: 'integer', nullable: true)]
  23. private $stockCount;
  24. #[ORM\Column(type: 'date', nullable: true)]
  25. private $expiryDate;
  26. #[ORM\Column(type: 'boolean')]
  27. private $taxExempt;
  28. #[ORM\Column(type: 'datetime')]
  29. private $modified;
  30. #[ORM\Column(type: 'datetime')]
  31. private $created;
  32. #[ORM\OneToMany(targetEntity: DistributorClinicPrices::class, mappedBy: 'product')]
  33. #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'product')]
  34. private $distributorClinicPrices;
  35. #[ORM\OneToMany(targetEntity: ListItems::class, mappedBy: 'distributorProduct')]
  36. private $listItems;
  37. #[ORM\Column(type: 'boolean', nullable: true)]
  38. private $isActive;
  39. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  40. private $itemId;
  41. #[ORM\Column(length: 255, nullable: true)]
  42. private ?string $urlToScrape = null;
  43. #[ORM\Column(nullable: true)]
  44. private ?int $page = null;
  45. public function __construct()
  46. {
  47. $date = new \DateTime("now", new \DateTimeZone('Asia/Dubai'));
  48. $this->setModified($date);
  49. if ($this->getCreated() == null)
  50. {
  51. $this->setCreated($date);
  52. }
  53. $this->distributorClinicPrices = new ArrayCollection();
  54. $this->listItems = new ArrayCollection();
  55. }
  56. public function getId(): ?int
  57. {
  58. return $this->id;
  59. }
  60. public function getDistributor(): ?Distributors
  61. {
  62. return $this->distributor;
  63. }
  64. public function setDistributor(?Distributors $distributor): self
  65. {
  66. $this->distributor = $distributor;
  67. return $this;
  68. }
  69. public function getProduct(): ?Products
  70. {
  71. return $this->product;
  72. }
  73. public function setProduct(?Products $product): self
  74. {
  75. $this->product = $product;
  76. return $this;
  77. }
  78. public function getSku(): ?string
  79. {
  80. return $this->sku;
  81. }
  82. public function setSku(string $sku): self
  83. {
  84. $this->sku = $sku;
  85. return $this;
  86. }
  87. public function getUnitPrice(): ?float
  88. {
  89. return $this->unitPrice;
  90. }
  91. public function setUnitPrice(float $unitPrice): self
  92. {
  93. $this->unitPrice = $unitPrice;
  94. return $this;
  95. }
  96. public function getStockCount(): ?int
  97. {
  98. return $this->stockCount;
  99. }
  100. public function setStockCount(int $stockCount): self
  101. {
  102. $this->stockCount = $stockCount;
  103. return $this;
  104. }
  105. public function getExpiryDate(): ?\DateTimeInterface
  106. {
  107. return $this->expiryDate;
  108. }
  109. public function setExpiryDate(\DateTimeInterface $expiryDate): self
  110. {
  111. $this->expiryDate = $expiryDate;
  112. return $this;
  113. }
  114. public function getTaxExempt(): ?bool
  115. {
  116. return $this->taxExempt;
  117. }
  118. public function setTaxExempt(bool $taxExempt): self
  119. {
  120. $this->taxExempt = $taxExempt;
  121. return $this;
  122. }
  123. public function getModified(): ?\DateTimeInterface
  124. {
  125. return $this->modified;
  126. }
  127. public function setModified(\DateTimeInterface $modified): self
  128. {
  129. $this->modified = $modified;
  130. return $this;
  131. }
  132. public function getCreated(): ?\DateTimeInterface
  133. {
  134. return $this->created;
  135. }
  136. public function setCreated(\DateTimeInterface $created): self
  137. {
  138. $this->created = $created;
  139. return $this;
  140. }
  141. /**
  142. * @return Collection|DistributorClinicPrices[]
  143. */
  144. public function getDistributorClinicPrices(): Collection
  145. {
  146. return $this->distributorClinicPrices;
  147. }
  148. public function addDistributorClinicPrice(DistributorClinicPrices $distributorClinicPrice): self
  149. {
  150. if (!$this->distributorClinicPrices->contains($distributorClinicPrice)) {
  151. $this->distributorClinicPrices[] = $distributorClinicPrice;
  152. $distributorClinicPrice->setProduct($this);
  153. }
  154. return $this;
  155. }
  156. public function removeDistributorClinicPrice(DistributorClinicPrices $distributorClinicPrice): self
  157. {
  158. if ($this->distributorClinicPrices->removeElement($distributorClinicPrice)) {
  159. // set the owning side to null (unless already changed)
  160. if ($distributorClinicPrice->getProduct() === $this) {
  161. $distributorClinicPrice->setProduct(null);
  162. }
  163. }
  164. return $this;
  165. }
  166. /**
  167. * @return Collection<int, ListItems>
  168. */
  169. public function getListItems(): Collection
  170. {
  171. return $this->listItems;
  172. }
  173. public function addListItem(ListItems $listItem): self
  174. {
  175. if (!$this->listItems->contains($listItem)) {
  176. $this->listItems[] = $listItem;
  177. $listItem->setDistributorProduct($this);
  178. }
  179. return $this;
  180. }
  181. public function removeListItem(ListItems $listItem): self
  182. {
  183. if ($this->listItems->removeElement($listItem)) {
  184. // set the owning side to null (unless already changed)
  185. if ($listItem->getDistributorProduct() === $this) {
  186. $listItem->setDistributorProduct(null);
  187. }
  188. }
  189. return $this;
  190. }
  191. public function getIsActive(): ?bool
  192. {
  193. return $this->isActive;
  194. }
  195. public function setIsActive(?bool $isActive): self
  196. {
  197. $this->isActive = $isActive;
  198. return $this;
  199. }
  200. public function getItemId(): ?string
  201. {
  202. return $this->itemId;
  203. }
  204. public function setItemId(?string $itemId): self
  205. {
  206. $this->itemId = $itemId;
  207. return $this;
  208. }
  209. public function getUrlToScrape(): ?string
  210. {
  211. return $this->urlToScrape;
  212. }
  213. public function setUrlToScrape(?string $urlToScrape): static
  214. {
  215. $this->urlToScrape = $urlToScrape;
  216. return $this;
  217. }
  218. public function getPage(): ?int
  219. {
  220. return $this->page;
  221. }
  222. public function setPage(?int $page): static
  223. {
  224. $this->page = $page;
  225. return $this;
  226. }
  227. }