src/Entity/Material.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MaterialRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClass: MaterialRepository::class)]
  6. class Material
  7. {
  8. const ADDED = 0;
  9. const INPROGRESS = 1;
  10. const INSTOCK = 2;
  11. const SOLD = 3;
  12. const LOCKED = 4;
  13. public static $statuses = [
  14. Material::ADDED=>'Rögzítve',
  15. Material::INPROGRESS => 'Folyamatban',
  16. Material::INSTOCK => 'Raktározva',
  17. Material::SOLD => 'Eladva',
  18. Material::LOCKED => 'Foglalva',
  19. ];
  20. #[ORM\Id]
  21. #[ORM\GeneratedValue]
  22. #[ORM\Column(type: 'integer')]
  23. private $id;
  24. #[ORM\ManyToOne(targetEntity: Projects::class, inversedBy: 'materials')]
  25. private $project;
  26. #[ORM\Column(type: 'string', length: 255)]
  27. private $name;
  28. #[ORM\Column(type: 'integer', nullable: true)]
  29. private $in_price_net;
  30. #[ORM\Column(type: 'integer', nullable: true)]
  31. private $in_price_br;
  32. #[ORM\Column(type: 'integer', nullable: true)]
  33. private $out_price_net;
  34. #[ORM\Column(type: 'integer', nullable: true)]
  35. private $out_price_br;
  36. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  37. private $supplier;
  38. #[ORM\Column(type: 'datetime', nullable: true)]
  39. private $created;
  40. #[ORM\Column(type: 'integer', nullable: true)]
  41. private $status;
  42. #[ORM\ManyToOne(targetEntity: ProjectProducts::class, inversedBy: 'materials')]
  43. private $projectProducts;
  44. #[ORM\Column(type: 'integer', nullable: true)]
  45. private $qty;
  46. public function __construct()
  47. {
  48. $this->qty = 1;
  49. }
  50. public function getId(): ?int
  51. {
  52. return $this->id;
  53. }
  54. public function getProject(): ?Projects
  55. {
  56. return $this->project;
  57. }
  58. public function setProject(?Projects $project): self
  59. {
  60. $this->project = $project;
  61. return $this;
  62. }
  63. public function getName(): ?string
  64. {
  65. return $this->name;
  66. }
  67. public function setName(string $name): self
  68. {
  69. $this->name = $name;
  70. return $this;
  71. }
  72. public function getInPriceNet(): ?int
  73. {
  74. return $this->in_price_net;
  75. }
  76. public function setInPriceNet(?int $in_price_net): self
  77. {
  78. $this->in_price_net = $in_price_net;
  79. return $this;
  80. }
  81. public function getInPriceBr(): ?int
  82. {
  83. return $this->in_price_br;
  84. }
  85. public function setInPriceBr(?int $in_price_br): self
  86. {
  87. $this->in_price_br = $in_price_br;
  88. return $this;
  89. }
  90. public function getOutPriceNet(): ?int
  91. {
  92. return $this->out_price_net;
  93. }
  94. public function setOutPriceNet(?int $out_price_net): self
  95. {
  96. $this->out_price_net = $out_price_net;
  97. return $this;
  98. }
  99. public function getOutPriceBr(): ?int
  100. {
  101. return $this->out_price_br;
  102. }
  103. public function setOutPriceBr(?int $out_price_br): self
  104. {
  105. $this->out_price_br = $out_price_br;
  106. return $this;
  107. }
  108. public function getSupplier(): ?string
  109. {
  110. return $this->supplier;
  111. }
  112. public function setSupplier(?string $supplier): self
  113. {
  114. $this->supplier = $supplier;
  115. return $this;
  116. }
  117. public function getCreated(): ?\DateTimeInterface
  118. {
  119. return $this->created;
  120. }
  121. public function setCreated(?\DateTimeInterface $created): self
  122. {
  123. $this->created = $created;
  124. return $this;
  125. }
  126. public function getStatus(): ?int
  127. {
  128. return $this->status;
  129. }
  130. public function getStatusName(): ?string
  131. {
  132. return self::$statuses[$this->status];
  133. }
  134. public function setStatus(?int $status): self
  135. {
  136. $this->status = $status;
  137. return $this;
  138. }
  139. public function getProjectProducts(): ?ProjectProducts
  140. {
  141. return $this->projectProducts;
  142. }
  143. public function setProjectProducts(?ProjectProducts $projectProducts): self
  144. {
  145. if($projectProducts){
  146. $this->setProject($projectProducts->getProject());
  147. }
  148. $this->projectProducts = $projectProducts;
  149. return $this;
  150. }
  151. public function getQty(): ?int
  152. {
  153. return $this->qty;
  154. }
  155. public function setQty(?int $qty): self
  156. {
  157. $this->qty = $qty;
  158. return $this;
  159. }
  160. }