src/Entity/SejourSessionPicture.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SejourSessionPictureRepository;
  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=SejourSessionPictureRepository::class)
  9. * @Vich\Uploadable
  10. */
  11. class SejourSessionPicture
  12. {
  13. const STATE_OPEN = "open";
  14. const STATE_VALIDATED = "validated";
  15. const STATE_REJECTED = "rejected";
  16. /**
  17. * @ORM\Id
  18. * @ORM\GeneratedValue
  19. * @ORM\Column(type="integer")
  20. */
  21. private $id;
  22. /**
  23. * @ORM\ManyToOne(targetEntity=SejourSession::class, inversedBy="sejourSessionPictures")
  24. * @ORM\JoinColumn(nullable=false)
  25. */
  26. private $sejourSession;
  27. /**
  28. * @ORM\Column(type="boolean")
  29. */
  30. private $isValidated;
  31. /**
  32. * @ORM\Column(type="boolean")
  33. */
  34. private $isFavorite;
  35. /**
  36. * @ORM\Column(type="datetime")
  37. */
  38. private $creationDate;
  39. /**
  40. * @ORM\Column(type="datetime", nullable=true)
  41. */
  42. private $updatedDate;
  43. /**
  44. * @ORM\Column(type="string", length=50, nullable=true)
  45. */
  46. private $state;
  47. /**
  48. * @ORM\Column(type="string", length=512, nullable=true)
  49. */
  50. private $filePath;
  51. /**
  52. * @Vich\UploadableField(mapping="frontend_image", fileNameProperty="filePath")
  53. *
  54. * @var File|null
  55. */
  56. private $imgFile;
  57. /**
  58. * @ORM\Column(type="datetime", nullable=true)
  59. */
  60. private $validDate;
  61. /**
  62. * @ORM\ManyToOne(targetEntity=User::class, inversedBy="medias")
  63. */
  64. private $userValid;
  65. /**
  66. * @ORM\ManyToOne(targetEntity=User::class, inversedBy="medias")
  67. */
  68. private $userCreated;
  69. public function __construct()
  70. {
  71. $this->creationDate = new \DateTime();
  72. }
  73. public function getId(): ?int
  74. {
  75. return $this->id;
  76. }
  77. public function getSejourSession(): ?SejourSession
  78. {
  79. return $this->sejourSession;
  80. }
  81. public function setSejourSession(?SejourSession $sejourSession): self
  82. {
  83. $this->sejourSession = $sejourSession;
  84. return $this;
  85. }
  86. public function getIsValidated(): ?bool
  87. {
  88. return $this->isValidated;
  89. }
  90. public function setIsValidated(bool $isValidated): self
  91. {
  92. $this->isValidated = $isValidated;
  93. return $this;
  94. }
  95. public function getIsFavorite(): ?bool
  96. {
  97. return $this->isFavorite;
  98. }
  99. public function setIsFavorite(bool $isFavorite): self
  100. {
  101. $this->isFavorite = $isFavorite;
  102. return $this;
  103. }
  104. public function getCreationDate(): ?\DateTimeInterface
  105. {
  106. return $this->creationDate;
  107. }
  108. public function setCreationDate(\DateTimeInterface $creationDate): self
  109. {
  110. $this->creationDate = $creationDate;
  111. return $this;
  112. }
  113. public function getState(): ?string
  114. {
  115. return $this->state;
  116. }
  117. public function setState(?string $state): self
  118. {
  119. $this->state = $state;
  120. return $this;
  121. }
  122. public function setImgFile(?File $imageFile = null): self
  123. {
  124. $this->imgFile = $imageFile;
  125. if ($imageFile) {
  126. // if 'updatedAt' is not defined in your entity, use another property
  127. $this->updatedDate = new \DateTime('now');
  128. }
  129. return $this;
  130. }
  131. public function getImgFile(): ?File
  132. {
  133. return $this->imgFile;
  134. }
  135. public function getFilePath(): ?string
  136. {
  137. return $this->filePath;
  138. }
  139. public function setFilePath(?string $filePath): self
  140. {
  141. $this->filePath = $filePath;
  142. return $this;
  143. }
  144. public function getUpdatedDate(): ?\DateTimeInterface
  145. {
  146. return $this->updatedDate;
  147. }
  148. public function setUpdatedDate(?\DateTimeInterface $updatedDate): self
  149. {
  150. $this->updatedDate = $updatedDate;
  151. return $this;
  152. }
  153. public function getValidDate(): ?\DateTimeInterface
  154. {
  155. return $this->validDate;
  156. }
  157. public function setValidDate(?\DateTimeInterface $validDate): self
  158. {
  159. $this->validDate = $validDate;
  160. return $this;
  161. }
  162. public function getUserValid(): ?User
  163. {
  164. return $this->userValid;
  165. }
  166. public function setUserValid(?User $userValid): self
  167. {
  168. $this->userValid = $userValid;
  169. $this->validDate = new \DateTime('now');
  170. return $this;
  171. }
  172. public function getUserCreated(): ?User
  173. {
  174. return $this->userCreated;
  175. }
  176. public function setUserCreated(?User $userCreated): self
  177. {
  178. $this->userCreated = $userCreated;
  179. return $this;
  180. }
  181. }