src/Entity/Baskets.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BasketsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClass: BasketsRepository::class)]
  8. class Baskets
  9. {
  10. #[ORM\Id]
  11. #[ORM\GeneratedValue]
  12. #[ORM\Column(type: 'integer')]
  13. private $id;
  14. #[ORM\ManyToOne(targetEntity: Clinics::class, inversedBy: 'baskets')]
  15. private $clinic;
  16. #[ORM\Column(type: 'float', nullable: true)]
  17. private $total;
  18. #[ORM\Column(type: 'string', length: 255)]
  19. private $name;
  20. #[ORM\Column(type: 'string', length: 255)]
  21. private $savedBy;
  22. #[ORM\Column(type: 'string', length: 255)]
  23. private $status;
  24. #[ORM\Column(type: 'datetime')]
  25. private $modified;
  26. #[ORM\Column(type: 'datetime')]
  27. private $created;
  28. #[ORM\OneToMany(targetEntity: BasketItems::class, mappedBy: 'basket')]
  29. private $basketItems;
  30. #[ORM\OneToOne(targetEntity: Orders::class, mappedBy: 'basket', cascade: ['persist', 'remove'])]
  31. private $orders;
  32. #[ORM\Column(type: 'integer', nullable: true)]
  33. private $isDefault;
  34. public function __construct()
  35. {
  36. $date = new \DateTime("now", new \DateTimeZone('Asia/Dubai'));
  37. $this->setModified($date);
  38. if ($this->getCreated() == null)
  39. {
  40. $this->setCreated($date);
  41. }
  42. $this->basketItems = new ArrayCollection();
  43. }
  44. public function getId(): ?int
  45. {
  46. return $this->id;
  47. }
  48. public function getClinic(): ?Clinics
  49. {
  50. return $this->clinic;
  51. }
  52. public function setClinic(?Clinics $clinic): self
  53. {
  54. $this->clinic = $clinic;
  55. return $this;
  56. }
  57. public function getTotal(): ?float
  58. {
  59. return $this->total;
  60. }
  61. public function setTotal(?float $total): self
  62. {
  63. $this->total = $total;
  64. return $this;
  65. }
  66. public function getName(): ?string
  67. {
  68. return $this->name;
  69. }
  70. public function setName(string $name): self
  71. {
  72. $this->name = $name;
  73. return $this;
  74. }
  75. public function getSavedBy(): ?string
  76. {
  77. return $this->savedBy;
  78. }
  79. public function setSavedBy(string $savedBy): self
  80. {
  81. $this->savedBy = $savedBy;
  82. return $this;
  83. }
  84. public function getStatus(): ?string
  85. {
  86. return $this->status;
  87. }
  88. public function setStatus(string $status): self
  89. {
  90. $this->status = $status;
  91. return $this;
  92. }
  93. public function getModified(): ?\DateTimeInterface
  94. {
  95. return $this->modified;
  96. }
  97. public function setModified(\DateTimeInterface $modified): self
  98. {
  99. $this->modified = $modified;
  100. return $this;
  101. }
  102. public function getCreated(): ?\DateTimeInterface
  103. {
  104. return $this->created;
  105. }
  106. public function setCreated(\DateTimeInterface $created): self
  107. {
  108. $this->created = $created;
  109. return $this;
  110. }
  111. /**
  112. * @return Collection<int, BasketItems>
  113. */
  114. public function getBasketItems(): Collection
  115. {
  116. return $this->basketItems;
  117. }
  118. public function addBasketItem(BasketItems $basketItem): self
  119. {
  120. if (!$this->basketItems->contains($basketItem)) {
  121. $this->basketItems[] = $basketItem;
  122. $basketItem->setBasket($this);
  123. }
  124. return $this;
  125. }
  126. public function removeBasketItem(BasketItems $basketItem): self
  127. {
  128. if ($this->basketItems->removeElement($basketItem)) {
  129. // set the owning side to null (unless already changed)
  130. if ($basketItem->getBasket() === $this) {
  131. $basketItem->setBasket(null);
  132. }
  133. }
  134. return $this;
  135. }
  136. public function getOrders(): ?Orders
  137. {
  138. return $this->orders;
  139. }
  140. public function setOrders(Orders $orders): self
  141. {
  142. // set the owning side of the relation if necessary
  143. if ($orders->getBasket() !== $this) {
  144. $orders->setBasket($this);
  145. }
  146. $this->orders = $orders;
  147. return $this;
  148. }
  149. public function getIsDefault(): ?int
  150. {
  151. return $this->isDefault;
  152. }
  153. public function setIsDefault(?int $isDefault): self
  154. {
  155. $this->isDefault = $isDefault;
  156. return $this;
  157. }
  158. }