src/Entity/PurchaseProductItem.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PurchaseProductItemRepository;
  4. use App\Traits\DateTrait;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use JMS\Serializer\Annotation as Serializer;
  7. use JMS\Serializer\Annotation\Expose;
  8. use JMS\Serializer\Annotation\Groups;
  9. /**
  10. * @ORM\Entity(repositoryClass=PurchaseProductItemRepository::class)
  11. *
  12. * @Serializer\ExclusionPolicy("ALL")
  13. */
  14. class PurchaseProductItem
  15. {
  16. /**
  17. * @ORM\Id
  18. * @ORM\GeneratedValue
  19. * @ORM\Column(type="integer")
  20. */
  21. private $id;
  22. /**
  23. * @ORM\ManyToOne(targetEntity=Purchase::class, inversedBy="items"))
  24. */
  25. private $purchase;
  26. /**
  27. * @ORM\Column(type="integer")
  28. */
  29. private $quantity;
  30. /**
  31. * @ORM\Column(type="decimal", precision=12, scale=4, nullable=true)
  32. */
  33. private $buyingPrice;
  34. /**
  35. * @ORM\ManyToOne(targetEntity=PurchaseProduct::class, inversedBy="purchaseItems")
  36. *
  37. * @@Serializer\Expose()
  38. * @Serializer\Groups({"export_purchase_declaration_datatable"})
  39. */
  40. private $product;
  41. /**
  42. * Longueur du produit
  43. *
  44. * @ORM\Column(type="integer", nullable=true)
  45. */
  46. private $width;
  47. /**
  48. * Hauteur du produit
  49. *
  50. * @ORM\Column(type="integer", nullable=true)
  51. */
  52. private $height;
  53. use DateTrait;
  54. /**
  55. * @return string
  56. * @Serializer\VirtualProperty()
  57. * @Serializer\SerializedName("product_ref_name")
  58. *
  59. * @Expose()
  60. * @Groups({"export_purchase_declaration_datatable"})
  61. */
  62. public function getProductRefName(): string
  63. {
  64. return $this->getProduct()->getRefName();
  65. }
  66. public function getId(): ?int
  67. {
  68. return $this->id;
  69. }
  70. public function getPurchase(): ?Purchase
  71. {
  72. return $this->purchase;
  73. }
  74. public function setPurchase( ?Purchase $purchase ): self
  75. {
  76. $this->purchase = $purchase;
  77. return $this;
  78. }
  79. public function getQuantity(): ?int
  80. {
  81. return $this->quantity;
  82. }
  83. public function setQuantity( int $quantity ): self
  84. {
  85. $this->quantity = $quantity;
  86. return $this;
  87. }
  88. public function getBuyingPrice(): ?string
  89. {
  90. return $this->buyingPrice;
  91. }
  92. public function setBuyingPrice( ?string $buyingPrice ): self
  93. {
  94. $this->buyingPrice = $buyingPrice;
  95. return $this;
  96. }
  97. public function getProduct(): ?PurchaseProduct
  98. {
  99. return $this->product;
  100. }
  101. public function setProduct( ?PurchaseProduct $product ): self
  102. {
  103. $this->product = $product;
  104. return $this;
  105. }
  106. public function getWidth(): ?int
  107. {
  108. return $this->width;
  109. }
  110. public function setWidth( ?int $width ): self
  111. {
  112. $this->width = $width;
  113. return $this;
  114. }
  115. public function getHeight(): ?int
  116. {
  117. return $this->height;
  118. }
  119. public function setHeight( ?int $height ): self
  120. {
  121. $this->height = $height;
  122. return $this;
  123. }
  124. }