src/Entity/ReductionRequest.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ReductionRequestRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. /**
  8. * @ORM\Entity(repositoryClass=ReductionRequestRepository::class)
  9. * @Vich\Uploadable
  10. */
  11. class ReductionRequest
  12. {
  13. const ACCEPTED = "accepted";
  14. const REJECTED = "rejected";
  15. public function __construct()
  16. {
  17. $this->creationDate = new \DateTime();
  18. }
  19. /**
  20. * @ORM\Id
  21. * @ORM\GeneratedValue
  22. * @ORM\Column(type="integer")
  23. */
  24. private $id;
  25. /**
  26. * @ORM\ManyToOne(targetEntity=Contact::class, inversedBy="reductionRequests")
  27. * @ORM\JoinColumn(nullable=false)
  28. */
  29. private $contact;
  30. /**
  31. * @ORM\ManyToOne(targetEntity=Reduction::class, inversedBy="reductionRequests")
  32. * @ORM\JoinColumn(nullable=true)
  33. */
  34. private $reduction;
  35. /**
  36. * @ORM\Column(type="string", length=255, nullable = true)
  37. */
  38. private $filePath;
  39. /**
  40. * @ORM\Column(type="boolean")
  41. */
  42. private $isValid;
  43. /**
  44. * @ORM\Column(type="datetime")
  45. */
  46. private $creationDate;
  47. /**
  48. * @Vich\UploadableField(mapping="private_file", fileNameProperty="filePath")
  49. *
  50. * @var File|null
  51. */
  52. private $imgFile;
  53. /**
  54. * @ORM\ManyToOne(targetEntity=Commande::class, inversedBy="reductionRequest", cascade={"persist", "remove"})
  55. * @ORM\JoinColumn(nullable=false)
  56. */
  57. private $commande;
  58. /**
  59. * @ORM\Column(type="string", length=255, nullable=true)
  60. */
  61. private $type;
  62. /**
  63. * @ORM\Column(type="string", length=255, nullable=true)
  64. */
  65. private $value;
  66. /**
  67. * @ORM\Column(type="string", length=255, nullable=true)
  68. */
  69. private $statut;
  70. public function getId(): ?int
  71. {
  72. return $this->id;
  73. }
  74. public function getImgFile(): ?File
  75. {
  76. return $this->imgFile;
  77. }
  78. public function getContact(): ?Contact
  79. {
  80. return $this->contact;
  81. }
  82. public function setContact(?Contact $contact): self
  83. {
  84. $this->contact = $contact;
  85. return $this;
  86. }
  87. public function getReduction(): ?Reduction
  88. {
  89. return $this->reduction;
  90. }
  91. public function setReduction(?Reduction $reduction): self
  92. {
  93. $this->reduction = $reduction;
  94. return $this;
  95. }
  96. public function getFilePath(): ?string
  97. {
  98. return $this->filePath;
  99. }
  100. public function setFilePath(string $filePath): self
  101. {
  102. $this->filePath = $filePath;
  103. return $this;
  104. }
  105. public function getIsValid(): ?bool
  106. {
  107. return $this->isValid;
  108. }
  109. public function setIsValid(bool $isValid): self
  110. {
  111. $this->isValid = $isValid;
  112. return $this;
  113. }
  114. public function getCreationDate(): ?\DateTimeInterface
  115. {
  116. return $this->creationDate;
  117. }
  118. public function setCreationDate(\DateTimeInterface $creationDate): self
  119. {
  120. $this->creationDate = $creationDate;
  121. return $this;
  122. }
  123. public function setImgFile(?File $imageFile = null): self
  124. {
  125. $this->imgFile = $imageFile;
  126. if ($imageFile) {
  127. // if 'updatedAt' is not defined in your entity, use another property
  128. $this->updatedDate = new \DateTime('now');
  129. }
  130. return $this;
  131. }
  132. public function getCommande(): ?Commande
  133. {
  134. return $this->commande;
  135. }
  136. public function setCommande(Commande $commande): self
  137. {
  138. $this->commande = $commande;
  139. return $this;
  140. }
  141. public function getType(): ?string
  142. {
  143. return $this->type;
  144. }
  145. public function setType(?string $type): self
  146. {
  147. $this->type = $type;
  148. return $this;
  149. }
  150. public function getValue(): ?string
  151. {
  152. return $this->value;
  153. }
  154. public function setValue(?string $value): self
  155. {
  156. $this->value = $value;
  157. return $this;
  158. }
  159. public function getStatut(): ?string
  160. {
  161. return $this->statut;
  162. }
  163. public function setStatut(?string $statut): self
  164. {
  165. $this->statut = $statut;
  166. return $this;
  167. }
  168. }