src/Entity/Application/StoreImage.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Application;
  3. use App\Entity\Application\Store;
  4. use App\Entity\User;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\HttpFoundation\File\File;
  7. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10. * @ORM\Entity(repositoryClass="App\Repository\Application\StoreImageRepository")
  11. * @ORM\EntityListeners({"App\Listener\EntityListener"})
  12. * @Vich\Uploadable()
  13. */
  14. class StoreImage
  15. {
  16. /**
  17. * @ORM\Id()
  18. * @ORM\GeneratedValue()
  19. * @ORM\Column(type="integer")
  20. */
  21. private $id;
  22. /**
  23. * @ORM\ManyToOne(targetEntity="Store", inversedBy="storeImages")
  24. * @ORM\JoinColumn(nullable=false)
  25. */
  26. private $store;
  27. /**
  28. * @ORM\Column(type="string", length=255)
  29. */
  30. private $image;
  31. /**
  32. * @ORM\Column(type="integer")
  33. */
  34. private $size;
  35. /**
  36. * @ORM\Column(type="integer", nullable=true)
  37. */
  38. private $orderBy;
  39. /**
  40. * @ORM\Column(type="string", length=100, nullable=true)
  41. */
  42. private $mimeType;
  43. /**
  44. * @ORM\Column(type="datetime", nullable=true)
  45. */
  46. private $deletets;
  47. /**
  48. * @ORM\ManyToOne(targetEntity="App\Entity\User")
  49. */
  50. private $deleteUser;
  51. /**
  52. * @ORM\Column(type="datetime")
  53. */
  54. private $createts;
  55. /**
  56. * @ORM\ManyToOne(targetEntity="App\Entity\User")
  57. * @ORM\JoinColumn(nullable=false)
  58. */
  59. private $createUser;
  60. /**
  61. *
  62. * @Vich\UploadableField(mapping="store_image", fileNameProperty="image", size="size", mimeType="mimeType")
  63. * @Assert\File(
  64. * maxSize = "4086k",
  65. * mimeTypes = {"image/png", "image/jpeg", "image/jpg"},
  66. * mimeTypesMessage = "Obrázek není ve správné formátu!"
  67. * )
  68. *
  69. * @var File
  70. */
  71. private $imageFile;
  72. public function getId(): ?int
  73. {
  74. return $this->id;
  75. }
  76. public function getStore(): ?Store
  77. {
  78. return $this->store;
  79. }
  80. public function setStore(?Store $store): self
  81. {
  82. $this->store = $store;
  83. return $this;
  84. }
  85. public function getImage(): ?string
  86. {
  87. return $this->image;
  88. }
  89. public function setImage(?string $image): self
  90. {
  91. $this->image = $image;
  92. return $this;
  93. }
  94. public function getSize(): ?int
  95. {
  96. return $this->size;
  97. }
  98. public function setSize(?int $size): self
  99. {
  100. $this->size = $size;
  101. return $this;
  102. }
  103. public function getMimeType(): ?string
  104. {
  105. return $this->mimeType;
  106. }
  107. public function setMimeType(?string $mimeType): self
  108. {
  109. $this->mimeType = $mimeType;
  110. return $this;
  111. }
  112. public function getDeletets(): ?\DateTimeInterface
  113. {
  114. return $this->deletets;
  115. }
  116. public function setDeletets(?\DateTimeInterface $deletets): self
  117. {
  118. $this->deletets = $deletets;
  119. return $this;
  120. }
  121. public function getDeleteUser(): ?User
  122. {
  123. return $this->deleteUser;
  124. }
  125. public function setDeleteUser(?User $deleteUser): self
  126. {
  127. $this->deleteUser = $deleteUser;
  128. return $this;
  129. }
  130. public function getCreatets(): ?\DateTimeInterface
  131. {
  132. return $this->createts;
  133. }
  134. public function setCreatets(\DateTimeInterface $createts): self
  135. {
  136. $this->createts = $createts;
  137. return $this;
  138. }
  139. public function getCreateUser(): ?User
  140. {
  141. return $this->createUser;
  142. }
  143. public function setCreateUser(?User $createUser): self
  144. {
  145. $this->createUser = $createUser;
  146. return $this;
  147. }
  148. public function getEditts(): ?\DateTimeInterface
  149. {
  150. return $this->editts;
  151. }
  152. public function setEditts(?\DateTimeInterface $editts): self
  153. {
  154. $this->editts = $editts;
  155. return $this;
  156. }
  157. public function getEditUser(): ?User
  158. {
  159. return $this->editUser;
  160. }
  161. public function setEditUser(?User $editUser): self
  162. {
  163. $this->editUser = $editUser;
  164. return $this;
  165. }
  166. /**
  167. * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image
  168. */
  169. public function setImageFile(?File $image = null)
  170. {
  171. $this->imageFile = $image;
  172. if (null !== $image) {
  173. $this->editts = new \DateTime();
  174. }
  175. }
  176. public function getImageFile()
  177. {
  178. return $this->imageFile;
  179. }
  180. /**
  181. * Get OrderBy
  182. *
  183. * @return mixed
  184. */
  185. public function getOrderBy()
  186. {
  187. return $this->orderBy;
  188. }
  189. /**
  190. * Set OrderBy
  191. *
  192. * @param mixed $orderBy
  193. */
  194. public function setOrderBy( $orderBy )
  195. {
  196. $this->orderBy = $orderBy;
  197. }
  198. }