src/Entity/Contracts.php line 13

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