src/Entity/SliderItem.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SliderItemRepository;
  4. use App\Traits\DateTrait;
  5. use DateTime;
  6. use DateTimeInterface;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. /**
  11. * @ORM\Entity(repositoryClass=SliderItemRepository::class)
  12. * @ORM\HasLifecycleCallbacks
  13. *
  14. * @Vich\Uploadable
  15. */
  16. class SliderItem
  17. {
  18. /**
  19. * @ORM\Id
  20. * @ORM\GeneratedValue
  21. * @ORM\Column(type="integer")
  22. */
  23. private $id;
  24. /**
  25. * @ORM\Column(type="string", length=255, nullable=true)
  26. */
  27. private $image;
  28. // Vich Uploader
  29. /**
  30. * @Vich\UploadableField(mapping="slider_item_images", fileNameProperty="image")
  31. * @var File
  32. */
  33. private $imageFile;
  34. /**
  35. * @ORM\Column(type="string", length=255, nullable=true)
  36. */
  37. private $url;
  38. /**
  39. * @ORM\Column(type="string", length=255, nullable=true)
  40. */
  41. private $urlcible;
  42. /**
  43. * @ORM\Column(type="integer", options={"default": 99})
  44. */
  45. private $orderItem;
  46. /**
  47. * @ORM\Column(type="string", length=255, nullable=true)
  48. */
  49. private $title;
  50. /**
  51. * @ORM\Column(type="string", length=255, nullable=true)
  52. */
  53. private $description;
  54. use DateTrait;
  55. /**
  56. * @ORM\ManyToOne(targetEntity=Slider::class, inversedBy="items")
  57. * @ORM\JoinColumn(nullable=false)
  58. */
  59. private $slider;
  60. /**
  61. * @ORM\Column(type="datetime", nullable=true)
  62. */
  63. private $dateStart;
  64. /**
  65. * @ORM\Column(type="datetime", nullable=true)
  66. */
  67. private $dateEnd;
  68. /**
  69. * @ORM\Column(type="boolean", nullable=true)
  70. */
  71. private $displayTitle;
  72. /**
  73. * @ORM\Column(type="string", length=255, nullable=true)
  74. */
  75. private $displayJob;
  76. /**
  77. * @ORM\Column(type="string", length=255, nullable=true)
  78. */
  79. private $displayUniverses;
  80. /**
  81. * @ORM\Column(type="string", length=255, nullable=true)
  82. */
  83. private $productSku;
  84. /**
  85. * @ORM\Column(type="boolean", nullable=true)
  86. */
  87. private $btnLink;
  88. /**
  89. * @ORM\Column(type="string", length=255, nullable=true)
  90. */
  91. private $btnText;
  92. /**
  93. * SliderItem constructor.
  94. *
  95. */
  96. public function __construct()
  97. {
  98. $this->orderItem = 99;
  99. }
  100. public function __toString()
  101. {
  102. return $this->image;
  103. }
  104. public function getId(): ?int
  105. {
  106. return $this->id;
  107. }
  108. public function getImageFile()
  109. {
  110. return $this->imageFile;
  111. }
  112. /**
  113. * @param File $imageFile
  114. *
  115. * @return void
  116. */
  117. public function setImageFile( File $imageFile ): void
  118. {
  119. $this->imageFile = $imageFile;
  120. if ( NULL !== $imageFile ) {
  121. // It is required that at least one field changes if you are using doctrine
  122. // otherwise the event listeners won't be called and the file is lost
  123. $this->updatedAt = new DateTime();
  124. }
  125. }
  126. public function getImage(): ?string
  127. {
  128. return $this->image;
  129. }
  130. public function setImage( ?string $image ): self
  131. {
  132. $this->image = $image;
  133. return $this;
  134. }
  135. public function getUrl(): ?string
  136. {
  137. return $this->url;
  138. }
  139. public function setUrl( ?string $url ): self
  140. {
  141. $this->url = $url;
  142. return $this;
  143. }
  144. public function getUrlcible(): ?string
  145. {
  146. return $this->urlcible;
  147. }
  148. public function setUrlcible( ?string $urlcible ): self
  149. {
  150. $this->urlcible = $urlcible;
  151. return $this;
  152. }
  153. public function getOrderItem(): ?int
  154. {
  155. return $this->orderItem;
  156. }
  157. public function setOrderItem( int $orderItem ): self
  158. {
  159. $this->orderItem = $orderItem;
  160. return $this;
  161. }
  162. public function getTitle(): ?string
  163. {
  164. return $this->title;
  165. }
  166. public function setTitle( ?string $title ): self
  167. {
  168. $this->title = $title;
  169. return $this;
  170. }
  171. public function getDescription(): ?string
  172. {
  173. return $this->description;
  174. }
  175. public function setDescription( ?string $description ): self
  176. {
  177. $this->description = $description;
  178. return $this;
  179. }
  180. public function getSlider(): ?Slider
  181. {
  182. return $this->slider;
  183. }
  184. public function setSlider( ?Slider $slider ): self
  185. {
  186. $this->slider = $slider;
  187. return $this;
  188. }
  189. public function getDateStart(): ?DateTimeInterface
  190. {
  191. return $this->dateStart;
  192. }
  193. public function setDateStart( ?DateTimeInterface $dateStart ): self
  194. {
  195. $this->dateStart = $dateStart;
  196. return $this;
  197. }
  198. public function getDateEnd(): ?DateTimeInterface
  199. {
  200. return $this->dateEnd;
  201. }
  202. public function setDateEnd( ?DateTimeInterface $dateEnd ): self
  203. {
  204. $this->dateEnd = $dateEnd;
  205. return $this;
  206. }
  207. public function isDisplayTitle(): ?bool
  208. {
  209. return $this->displayTitle;
  210. }
  211. public function setDisplayTitle(?bool $displayTitle): self
  212. {
  213. $this->displayTitle = $displayTitle;
  214. return $this;
  215. }
  216. public function getDisplayJob(): ?array
  217. {
  218. if ($this->displayJob === NULL) {
  219. return NULL;
  220. }
  221. return explode(';', $this->displayJob);
  222. }
  223. public function setDisplayJob(?array $displayJob): self
  224. {
  225. if ($displayJob === []) {
  226. $this->displayJob = NULL;
  227. } else {
  228. $this->displayJob = implode(';', $displayJob);
  229. }
  230. return $this;
  231. }
  232. public function getDisplayUniverses(): ?array
  233. {
  234. if ($this->displayUniverses === NULL) {
  235. return NULL;
  236. }
  237. return explode(';', $this->displayUniverses);
  238. }
  239. public function setDisplayUniverses(?array $displayUniverses): self
  240. {
  241. if ($displayUniverses === []) {
  242. $this->displayUniverses = NULL;
  243. } else {
  244. $this->displayUniverses = implode(';', $displayUniverses);
  245. }
  246. return $this;
  247. }
  248. public function getProductSku(): ?string
  249. {
  250. return $this->productSku;
  251. }
  252. public function setProductSku(?string $productSku): self
  253. {
  254. $this->productSku = $productSku;
  255. return $this;
  256. }
  257. public function isBtnLink(): ?bool
  258. {
  259. return $this->btnLink;
  260. }
  261. public function setBtnLink(?bool $btnLink): self
  262. {
  263. $this->btnLink = $btnLink;
  264. return $this;
  265. }
  266. public function getBtnText(): ?string
  267. {
  268. return $this->btnText;
  269. }
  270. public function setBtnText(?string $btnText): self
  271. {
  272. $this->btnText = $btnText;
  273. return $this;
  274. }
  275. }