src/Entity/Contracts.php line 18

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