src/Entity/System/ProductStock.php line 19

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\System;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Table(
  7. * uniqueConstraints={
  8. *
  9. * @ORM\UniqueConstraint(name="uk_product_product_attribute_reference", columns={"product_id", "product_attribute_id", "reference"})
  10. * }
  11. * )
  12. *
  13. * @ORM\Entity(repositoryClass="App\Repository\System\ProductStockRepository")
  14. */
  15. class ProductStock
  16. {
  17. public const JIT_MIN_DAYS = 1;
  18. public const JIT_MAX_DAYS = 2;
  19. public const JIT_3_5_MIN_DAYS = 3;
  20. public const JIT_3_5_MAX_DAYS = 5;
  21. public const IMMEDIATE_STOCK_MIN_DAYS = 0;
  22. public const IMMEDIATE_STOCK_MAX_DAYS = 0;
  23. public const STOCK_WITHOUT_PURCHASE_ID_REFERENCE = '0';
  24. /**
  25. * @ORM\Column(type="integer")
  26. *
  27. * @ORM\Id
  28. *
  29. * @ORM\GeneratedValue(strategy="AUTO")
  30. */
  31. protected int $id;
  32. /**
  33. * @ORM\Column(type="string", length=32, unique=true, nullable=true)
  34. */
  35. protected ?string $reference;
  36. /**
  37. * @ORM\ManyToOne(targetEntity="App\Entity\System\Product", inversedBy="productStocks", cascade={"persist"})
  38. *
  39. * @ORM\JoinColumn(referencedColumnName="id_product", nullable=false)
  40. */
  41. private Product $product;
  42. /**
  43. * @ORM\ManyToOne(targetEntity="ProductAttribute", cascade={"persist"})
  44. *
  45. * @ORM\JoinColumn(referencedColumnName="id_product_attribute")
  46. */
  47. private ?ProductAttribute $productAttribute;
  48. /**
  49. * @ORM\Column(type="integer", nullable=false, options={"default":0})
  50. */
  51. private int $originalQuantity = 0;
  52. /**
  53. * @ORM\Column(type="integer", nullable=false, options={"default":0})
  54. */
  55. private int $quantity = 0;
  56. /**
  57. * @ORM\Column(type="integer", nullable=false, options={"default":0})
  58. */
  59. private int $quantityPurchased = 0;
  60. /**
  61. * @ORM\Column(type="integer")
  62. */
  63. private int $minimumHandlingDays;
  64. /**
  65. * @ORM\Column(type="integer")
  66. */
  67. private int $maximumHandlingDays;
  68. /**
  69. * @ORM\Column(type="datetime")
  70. */
  71. private \DateTime $dateAdd;
  72. /**
  73. * @ORM\Column(type="datetime")
  74. */
  75. private \DateTime $dateUpdate;
  76. /**
  77. * @ORM\Column(type="boolean", nullable=false, options={"default":0})
  78. */
  79. private bool $purchaseAvailable;
  80. /**
  81. * @var Warehouse
  82. *
  83. * @ORM\ManyToOne(targetEntity="App\Entity\System\Warehouse")
  84. *
  85. * @ORM\JoinColumn(name="warehouse_id", referencedColumnName="id", nullable=false, options={"default":1})
  86. */
  87. private $warehouse;
  88. public function __construct()
  89. {
  90. $this->dateAdd = new \DateTime();
  91. $this->dateUpdate = new \DateTime();
  92. $this->purchaseAvailable = false;
  93. }
  94. public function getId(): int
  95. {
  96. return $this->id;
  97. }
  98. public function getReference(): ?string
  99. {
  100. return $this->reference;
  101. }
  102. public function setReference(?string $reference): ProductStock
  103. {
  104. $this->reference = $reference;
  105. return $this;
  106. }
  107. public function getProduct(): Product
  108. {
  109. return $this->product;
  110. }
  111. public function setProduct(Product $product): ProductStock
  112. {
  113. $this->product = $product;
  114. return $this;
  115. }
  116. public function getProductAttribute(): ?ProductAttribute
  117. {
  118. return $this->productAttribute;
  119. }
  120. public function setProductAttribute(?ProductAttribute $productAttribute): ProductStock
  121. {
  122. $this->productAttribute = $productAttribute;
  123. return $this;
  124. }
  125. public function getQuantity(): int
  126. {
  127. return $this->quantity;
  128. }
  129. public function setQuantity(int $quantity): ProductStock
  130. {
  131. $this->quantity = $quantity;
  132. return $this;
  133. }
  134. public function getMinimumHandlingDays(): int
  135. {
  136. return $this->minimumHandlingDays;
  137. }
  138. public function setMinimumHandlingDays(int $minimumHandlingDays): ProductStock
  139. {
  140. $this->minimumHandlingDays = $minimumHandlingDays;
  141. return $this;
  142. }
  143. public function getMaximumHandlingDays(): int
  144. {
  145. return $this->maximumHandlingDays;
  146. }
  147. public function setMaximumHandlingDays(int $maximumHandlingDays): ProductStock
  148. {
  149. $this->maximumHandlingDays = $maximumHandlingDays;
  150. return $this;
  151. }
  152. public function getDateAdd(): \DateTime
  153. {
  154. return $this->dateAdd;
  155. }
  156. public function setDateAdd(\DateTime $dateAdd): ProductStock
  157. {
  158. $this->dateAdd = $dateAdd;
  159. return $this;
  160. }
  161. public function getDateUpdate(): \DateTime
  162. {
  163. return $this->dateUpdate;
  164. }
  165. public function setDateUpdate(\DateTime $dateUpdate): ProductStock
  166. {
  167. $this->dateUpdate = $dateUpdate;
  168. return $this;
  169. }
  170. public function getOriginalQuantity(): int
  171. {
  172. return $this->originalQuantity;
  173. }
  174. public function setOriginalQuantity(int $originalQuantity): ProductStock
  175. {
  176. $this->originalQuantity = $originalQuantity;
  177. return $this;
  178. }
  179. public function getQuantityPurchased(): int
  180. {
  181. return $this->quantityPurchased;
  182. }
  183. public function setQuantityPurchased(int $quantityPurchased): ProductStock
  184. {
  185. $this->quantityPurchased = $quantityPurchased;
  186. return $this;
  187. }
  188. public function getWarehouse(): Warehouse
  189. {
  190. return $this->warehouse;
  191. }
  192. public function setWarehouse(Warehouse $warehouse): void
  193. {
  194. $this->warehouse = $warehouse;
  195. }
  196. public function isPurchaseAvailable(): bool
  197. {
  198. return $this->purchaseAvailable;
  199. }
  200. public function setPurchaseAvailable(bool $purchaseAvailable): ProductStock
  201. {
  202. $this->purchaseAvailable = $purchaseAvailable;
  203. return $this;
  204. }
  205. }