src/Entity/QuoteItems.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. #[ORM\Table(name: 'quote_items', indexes: [new ORM\Index(name: 'quote_id', columns: ['quote_id'])])]
  5. #[ORM\Entity]
  6. class QuoteItems
  7. {
  8. const PAINT = 0;
  9. const ASSEMBLY = 1;
  10. const BODYGUARD = 2;
  11. const OTHER = 3;
  12. #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
  13. #[ORM\Id]
  14. #[ORM\GeneratedValue(strategy: 'IDENTITY')]
  15. private $id;
  16. #[ORM\Column(name: 'type', type: 'integer', nullable: false)]
  17. private $type;
  18. #[ORM\Column(name: 'price_qty', type: 'integer', nullable: true)]
  19. private $priceQty;
  20. #[ORM\Column(name: 'qty', type: 'float', nullable: true)]
  21. private $qty;
  22. #[ORM\Column(name: 'price_sum', type: 'integer', nullable: true)]
  23. private $priceSum;
  24. #[ORM\Column(name: 'note', type: 'text', length: 65535, nullable: true)]
  25. private $note;
  26. #[ORM\Column(name: 'created', type: 'datetime', nullable: false)]
  27. private $created;
  28. #[ORM\ManyToOne(targetEntity: 'Quotes', cascade: ['persist'], inversedBy: 'quoteItems')]
  29. #[ORM\JoinColumn(name: 'quote_id', referencedColumnName: 'id')]
  30. private $quote;
  31. #[ORM\Column(name: 'modified', type: 'datetime', nullable: true, options: ['comment' => 'Módosítva'])]
  32. private $modified;
  33. public function __construct()
  34. {
  35. $this->created = new \DateTime();
  36. $this->type = 0;
  37. }
  38. public function getId(): ?int
  39. {
  40. return $this->id;
  41. }
  42. public function getType(): ?int
  43. {
  44. return $this->type;
  45. }
  46. public function setType(int $type): self
  47. {
  48. $this->type = $type;
  49. return $this;
  50. }
  51. public function getPriceQty(): ?int
  52. {
  53. return $this->priceQty;
  54. }
  55. public function setPriceQty(?int $priceQty): self
  56. {
  57. $this->priceQty = $priceQty;
  58. return $this;
  59. }
  60. public function getQty(): ?float
  61. {
  62. return $this->qty;
  63. }
  64. public function setQty(?float $qty): self
  65. {
  66. $this->qty = $qty;
  67. return $this;
  68. }
  69. public function getPriceSum(): ?int
  70. {
  71. return $this->priceSum;
  72. }
  73. public function setPriceSum(?int $priceSum): self
  74. {
  75. $this->priceSum = $priceSum;
  76. return $this;
  77. }
  78. public function getNote(): ?string
  79. {
  80. return $this->note;
  81. }
  82. public function setNote(?string $note): self
  83. {
  84. $this->note = $note;
  85. return $this;
  86. }
  87. public function getCreated(): ?\DateTimeInterface
  88. {
  89. return $this->created;
  90. }
  91. public function setCreated(\DateTimeInterface $created): self
  92. {
  93. $this->created = $created;
  94. return $this;
  95. }
  96. public function getQuote(): ?Quotes
  97. {
  98. return $this->quote;
  99. }
  100. public function setQuote(?Quotes $quote): self
  101. {
  102. $this->quote = $quote;
  103. return $this;
  104. }
  105. public function __toString(){
  106. return $this->note;
  107. }
  108. public function getQtyType(){
  109. switch ($this->type) {
  110. case QuoteItems::PAINT:
  111. case QuoteItems::ASSEMBLY:
  112. case QuoteItems::BODYGUARD:
  113. return "Munkaóra";
  114. break;
  115. case QuoteItems::OTHER:
  116. return "Darab";
  117. break;
  118. }
  119. }
  120. public function getQtyPriceType(){
  121. switch ($this->type) {
  122. case QuoteItems::PAINT:
  123. case QuoteItems::ASSEMBLY:
  124. case QuoteItems::BODYGUARD:
  125. return "Óradíj";
  126. break;
  127. case QuoteItems::OTHER:
  128. return "Egységár";
  129. break;
  130. }
  131. }
  132. public function getModified(): ?\DateTimeInterface
  133. {
  134. return $this->modified;
  135. }
  136. }