src/Entity/Web/ModalTranslation.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Web;
  3. use App\Repository\Web\ModalTranslationRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Entity\Behaviors\TranslationTrait;
  6. use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. /**
  11. * @ORM\Table(name="web_modal_translation")
  12. * @ORM\Entity(repositoryClass=ModalTranslationRepository::class)
  13. * @ORM\EntityListeners({"App\Listener\EntityListener"})
  14. * @Vich\Uploadable()
  15. */
  16. class ModalTranslation implements TranslationInterface
  17. {
  18. use TranslationTrait;
  19. /**
  20. * @ORM\Column(type="string", length=255, nullable=true)
  21. */
  22. private $title;
  23. /**
  24. * @Vich\UploadableField(mapping="modal", fileNameProperty="image")
  25. * @Assert\Image(mimeTypes={"image/png", "image/jpeg", "image/jpg", "image/gif"})
  26. * @var File|null
  27. */
  28. private $imageFile;
  29. /**
  30. * @ORM\Column(type="string", length=255, nullable=true)
  31. */
  32. private $image;
  33. /**
  34. * @ORM\Column(type="text", nullable=true)
  35. */
  36. private $text;
  37. /**
  38. * @ORM\Column(type="string", length=255, nullable=true)
  39. */
  40. private $url;
  41. /**
  42. * @ORM\Column(type="string", length=2)
  43. */
  44. protected $locale;
  45. /**
  46. * @ORM\Column(type="datetime")
  47. */
  48. private $createts;
  49. /**
  50. * @ORM\ManyToOne(targetEntity="App\Entity\User")
  51. * @ORM\JoinColumn(nullable=false)
  52. */
  53. private $createUser;
  54. /**
  55. * @ORM\Column(type="datetime", nullable=true)
  56. */
  57. private $editts;
  58. /**
  59. * @ORM\ManyToOne(targetEntity="App\Entity\User")
  60. */
  61. private $editUser;
  62. public function __construct($locale = null) {
  63. if($locale !== null){
  64. $this->setLocale($locale);
  65. }
  66. }
  67. public function getTitle(): ?string
  68. {
  69. return $this->title;
  70. }
  71. public function setTitle(?string $title): self
  72. {
  73. $this->title = $title;
  74. return $this;
  75. }
  76. public function getImage(): ?string
  77. {
  78. return $this->image;
  79. }
  80. public function setImage(?string $image): self
  81. {
  82. $this->image = $image;
  83. return $this;
  84. }
  85. public function getText(): ?string
  86. {
  87. return $this->text;
  88. }
  89. public function setText(?string $text): self
  90. {
  91. $this->text = $text;
  92. return $this;
  93. }
  94. public function getUrl(): ?string
  95. {
  96. return $this->url;
  97. }
  98. public function setUrl(?string $url): self
  99. {
  100. $this->url = $url;
  101. return $this;
  102. }
  103. /**
  104. * @return mixed
  105. */
  106. public function getLocale(): string
  107. {
  108. return $this->locale;
  109. }
  110. /**
  111. * @param mixed $locale
  112. */
  113. public function setLocale($locale): void
  114. {
  115. $this->locale = $locale;
  116. }
  117. /**
  118. * @return mixed
  119. */
  120. public function getCreatets()
  121. {
  122. return $this->createts;
  123. }
  124. /**
  125. * @param mixed $createts
  126. */
  127. public function setCreatets($createts): void
  128. {
  129. $this->createts = $createts;
  130. }
  131. /**
  132. * @return mixed
  133. */
  134. public function getCreateUser()
  135. {
  136. return $this->createUser;
  137. }
  138. /**
  139. * @param mixed $createUser
  140. */
  141. public function setCreateUser($createUser): void
  142. {
  143. $this->createUser = $createUser;
  144. }
  145. /**
  146. * @return mixed
  147. */
  148. public function getEditts()
  149. {
  150. return $this->editts;
  151. }
  152. /**
  153. * @param mixed $editts
  154. */
  155. public function setEditts($editts): void
  156. {
  157. $this->editts = $editts;
  158. }
  159. /**
  160. * @return mixed
  161. */
  162. public function getEditUser()
  163. {
  164. return $this->editUser;
  165. }
  166. /**
  167. * @param mixed $editUser
  168. */
  169. public function setEditUser($editUser): void
  170. {
  171. $this->editUser = $editUser;
  172. }
  173. /**
  174. * Get ImageFile
  175. *
  176. * @return null|File
  177. */
  178. public function getImageFile()
  179. {
  180. return $this->imageFile;
  181. }
  182. /**
  183. * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
  184. */
  185. public function setImageFile(?File $imageFile = null): void
  186. {
  187. $this->imageFile = $imageFile;
  188. if (null !== $imageFile) {
  189. $this->editts = new \DateTime();
  190. }
  191. }
  192. }