src/Entity/SaleOrderShipment.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SaleOrderShipmentRepository;
  4. use App\Traits\DateTrait;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use JMS\Serializer\Annotation as Serializer;
  9. use JMS\Serializer\Annotation\Expose;
  10. use JMS\Serializer\Annotation\Groups;
  11. /**
  12. * @ORM\Entity(repositoryClass=SaleOrderShipmentRepository::class)
  13. *
  14. * @Serializer\ExclusionPolicy("ALL")
  15. */
  16. class SaleOrderShipment
  17. {
  18. /**
  19. * @ORM\Id
  20. * @ORM\GeneratedValue
  21. * @ORM\Column(type="integer")
  22. *
  23. * @Expose
  24. * @Groups({
  25. * "sale_order",
  26. * "sale_order:updated",
  27. * "get:read"
  28. * })
  29. */
  30. private $id;
  31. /**
  32. * @TODO anciennement '$order' mais c'est un mot réservé, on peut pas l'utiliser
  33. * @ORM\ManyToOne(targetEntity=SaleOrder::class, inversedBy="shipments")
  34. * @ORM\JoinColumn(nullable=false)
  35. */
  36. private $saleOrder;
  37. /**
  38. * @ORM\Column(type="string", length=64, nullable=true)
  39. *
  40. * @Expose
  41. * @Groups({
  42. * "sale_order",
  43. * "sale_order:item",
  44. * "sale_order:updated",
  45. * "get:read",
  46. * "export_order_datatable"
  47. * })
  48. */
  49. private $trackingCode;
  50. /**
  51. * @ORM\Column(type="text", nullable=true)
  52. *
  53. * @Expose
  54. * @Groups({
  55. * "sale_order",
  56. * "sale_order:updated"
  57. * })
  58. */
  59. private ?string $trackingUrl = null;
  60. /**
  61. * @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
  62. *
  63. * @Expose
  64. * @Groups({
  65. * "sale_order",
  66. * "sale_order:updated",
  67. * "get:read",
  68. * "export_order_datatable"
  69. * })
  70. */
  71. private $weight;
  72. /**
  73. * @ORM\Column(type="string", length=64, nullable=true)
  74. *
  75. * @Expose
  76. * @Groups({
  77. * "sale_order",
  78. * "sale_order:updated",
  79. * "sale_order:item",
  80. * "export_order_datatable"
  81. * })
  82. */
  83. private $carrier;
  84. /**
  85. * @ORM\Column(type="integer", nullable=true)
  86. */
  87. private $boId;
  88. /**
  89. * @ORM\OneToMany(
  90. * targetEntity=SaleOrderShipmentItem::class,
  91. * mappedBy="saleOrderShipment",
  92. * cascade={"persist", "remove"},
  93. * orphanRemoval=true)
  94. */
  95. private $saleOrderShipmentItems;
  96. /**
  97. * @ORM\Column(type="float", nullable=true)
  98. */
  99. private $shippingCost;
  100. public function __construct()
  101. {
  102. $this->saleOrderShipmentItems = new ArrayCollection();
  103. }
  104. use DateTrait;
  105. public function getId(): ?int
  106. {
  107. return $this->id;
  108. }
  109. public function getTrackingCode(): ?string
  110. {
  111. return $this->trackingCode;
  112. }
  113. public function setTrackingCode( ?string $trackingCode ): self
  114. {
  115. $this->trackingCode = $trackingCode;
  116. return $this;
  117. }
  118. public function getTrackingUrl(): ?string
  119. {
  120. return $this->trackingUrl;
  121. }
  122. public function setTrackingUrl( ?string $trackingUrl ): self
  123. {
  124. $this->trackingUrl = $trackingUrl;
  125. return $this;
  126. }
  127. public function getWeight(): ?string
  128. {
  129. return $this->weight;
  130. }
  131. public function setWeight( ?string $weight ): self
  132. {
  133. $this->weight = $weight;
  134. return $this;
  135. }
  136. public function getCarrier(): ?string
  137. {
  138. return $this->carrier;
  139. }
  140. public function setCarrier( ?string $carrier ): self
  141. {
  142. $this->carrier = $carrier;
  143. return $this;
  144. }
  145. public function getSaleOrder(): ?SaleOrder
  146. {
  147. return $this->saleOrder;
  148. }
  149. public function setSaleOrder( ?SaleOrder $saleOrder ): self
  150. {
  151. $this->saleOrder = $saleOrder;
  152. return $this;
  153. }
  154. public function getBoId(): ?int
  155. {
  156. return $this->boId;
  157. }
  158. public function setBoId( ?int $boId ): self
  159. {
  160. $this->boId = $boId;
  161. return $this;
  162. }
  163. /**
  164. * @return Collection<int, SaleOrderShipmentItem>
  165. */
  166. public function getSaleOrderShipmentItems(): Collection
  167. {
  168. return $this->saleOrderShipmentItems;
  169. }
  170. public function addSaleOrderShipmentItem(SaleOrderShipmentItem $saleOrderShipmentItem): self
  171. {
  172. if (!$this->saleOrderShipmentItems->contains($saleOrderShipmentItem)) {
  173. $this->saleOrderShipmentItems[] = $saleOrderShipmentItem;
  174. $saleOrderShipmentItem->setSaleOrderShipment($this);
  175. }
  176. return $this;
  177. }
  178. public function removeSaleOrderShipmentItem(SaleOrderShipmentItem $saleOrderShipmentItem): self
  179. {
  180. if ($this->saleOrderShipmentItems->removeElement($saleOrderShipmentItem)) {
  181. // set the owning side to null (unless already changed)
  182. if ($saleOrderShipmentItem->getSaleOrderShipment() === $this) {
  183. $saleOrderShipmentItem->setSaleOrderShipment(null);
  184. }
  185. }
  186. return $this;
  187. }
  188. public function getShippingCost(): ?float
  189. {
  190. return $this->shippingCost;
  191. }
  192. public function setShippingCost(?float $shippingCost): self
  193. {
  194. $this->shippingCost = $shippingCost;
  195. return $this;
  196. }
  197. }