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