src/Entity/Contracts.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ContractsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClass: ContractsRepository::class)]
  8. class Contracts
  9. {
  10. public static $statuses = [0=>'Létrehozva',1=>'Elfogadva',2=>'Kiküldve',3=>'Aláírva'];
  11. #[ORM\Id]
  12. #[ORM\GeneratedValue]
  13. #[ORM\Column(type: 'integer')]
  14. private $id;
  15. #[ORM\ManyToOne(targetEntity: Customers::class, inversedBy: 'contracts')]
  16. private $customer;
  17. #[ORM\Column(type: 'integer', nullable: true)]
  18. private $price_net;
  19. #[ORM\Column(type: 'integer', nullable: true)]
  20. private $price_brt;
  21. #[ORM\Column(type: 'integer', nullable: true)]
  22. private $title;
  23. #[ORM\Column(type: 'text')]
  24. private $contract;
  25. #[ORM\Column(type: 'date')]
  26. private $created;
  27. #[ORM\Column(type: 'integer')]
  28. private $status;
  29. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  30. private $work_address;
  31. #[ORM\Column(type: 'integer', nullable: true)]
  32. private $production_days;
  33. #[ORM\Column(type: 'date', nullable: true)]
  34. private $production_deadline;
  35. #[ORM\Column(type: 'integer', nullable: true)]
  36. private $deposit_price_br;
  37. #[ORM\OneToMany(targetEntity: PdfFiles::class, mappedBy: 'contracts')]
  38. private $files;
  39. public function __construct()
  40. {
  41. $this->files = new ArrayCollection();
  42. $this->created = new \DateTime();
  43. $this->status = 0;
  44. }
  45. public function getId(): ?int
  46. {
  47. return $this->id;
  48. }
  49. public function getCustomer(): ?Customers
  50. {
  51. return $this->customer;
  52. }
  53. public function setCustomer(?Customers $customer): self
  54. {
  55. $this->customer = $customer;
  56. return $this;
  57. }
  58. public function getPriceNet(): ?int
  59. {
  60. return $this->price_net;
  61. }
  62. public function setPriceNet(?int $price_net): self
  63. {
  64. $this->price_net = $price_net;
  65. $this->setPriceBrt($price_net*1.27);
  66. return $this;
  67. }
  68. public function getPriceBrt(): ?int
  69. {
  70. return $this->price_brt;
  71. }
  72. public function setPriceBrt(?int $price_brt): self
  73. {
  74. $this->price_brt = $price_brt;
  75. return $this;
  76. }
  77. public function getTitle(): ?string
  78. {
  79. return $this->title;
  80. }
  81. public function setTitle(string $title): self
  82. {
  83. $this->title = $title;
  84. return $this;
  85. }
  86. public function getContract(): ?string
  87. {
  88. if($this->contract === null){
  89. $this->contract = file_get_contents(dirname(__FILE__).'/../../gortech_contract.md');
  90. }
  91. return $this->contract;
  92. }
  93. public function setContract(string $contract): self
  94. {
  95. $this->contract = $contract;
  96. return $this;
  97. }
  98. public function getCreated(): ?\DateTimeInterface
  99. {
  100. return $this->created;
  101. }
  102. public function setCreated(\DateTimeInterface $created): self
  103. {
  104. $this->created = $created;
  105. return $this;
  106. }
  107. public function getStatus(): ?int
  108. {
  109. return $this->status;
  110. }
  111. public function setStatus(int $status): self
  112. {
  113. $this->status = $status;
  114. return $this;
  115. }
  116. public function getWorkAddress(): ?string
  117. {
  118. return $this->work_address;
  119. }
  120. public function setWorkAddress(?string $work_address): self
  121. {
  122. $this->work_address = $work_address;
  123. return $this;
  124. }
  125. public function getProductionDays(): ?int
  126. {
  127. return $this->production_days;
  128. }
  129. public function setProductionDays(?int $production_days): self
  130. {
  131. $this->production_days = $production_days;
  132. return $this;
  133. }
  134. public function getProductionDeadline(): ?\DateTimeInterface
  135. {
  136. return $this->production_deadline;
  137. }
  138. public function setProductionDeadline(?\DateTimeInterface $production_deadline): self
  139. {
  140. $this->production_deadline = $production_deadline;
  141. return $this;
  142. }
  143. public function getDepositPriceBr(): ?int
  144. {
  145. return $this->deposit_price_br;
  146. }
  147. public function setDepositPriceBr(?int $deposit_price_br): self
  148. {
  149. $this->deposit_price_br = $deposit_price_br;
  150. return $this;
  151. }
  152. /**
  153. * @return Collection|PdfFiles[]
  154. */
  155. public function getFiles(): Collection
  156. {
  157. return $this->files;
  158. }
  159. public function addFile(PdfFiles $file): self
  160. {
  161. if (!$this->files->contains($file)) {
  162. $this->files[] = $file;
  163. $file->setContracts($this);
  164. }
  165. return $this;
  166. }
  167. public function removeFile(PdfFiles $file): self
  168. {
  169. if ($this->files->removeElement($file)) {
  170. // set the owning side to null (unless already changed)
  171. if ($file->getContracts() === $this) {
  172. $file->setContracts(null);
  173. }
  174. }
  175. return $this;
  176. }
  177. }