src/Entity/Slide.php line 16

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use App\Repository\SlideRepository;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=SlideRepository::class)
  9. * @ORM\Table(name="sulu_manual_carousel_slides")
  10. * @ORM\HasLifecycleCallbacks()
  11. */
  12. class Slide
  13. {
  14. public const DISTRIBUTION_MODE_ALL = 'ALL';
  15. public const DISTRIBUTION_MODE_INCLUDE = 'INCLUDE';
  16. public const DISTRIBUTION_MODE_ALL_EXCEPT = 'ALL_EXCEPT';
  17. /**
  18. * @ORM\Id
  19. * @ORM\GeneratedValue
  20. * @ORM\Column(type="integer")
  21. */
  22. private ?int $id = null;
  23. /**
  24. * Titre du slide (remplace le titre du carousel)
  25. * @ORM\Column(type="string", length=255)
  26. */
  27. private string $title = '';
  28. /**
  29. * Type de carousel (hero_section, carousel01, etc.)
  30. * @ORM\Column(type="string", length=50, nullable=true)
  31. */
  32. private ?string $type = null;
  33. /**
  34. * @ORM\Column(type="integer")
  35. */
  36. private int $position = 0;
  37. /**
  38. * @ORM\Column(type="boolean")
  39. */
  40. private bool $active = true;
  41. /**
  42. * @ORM\Column(type="datetime", nullable=true)
  43. */
  44. private ?\DateTimeInterface $startAt = null;
  45. /**
  46. * @ORM\Column(type="datetime", nullable=true)
  47. */
  48. private ?\DateTimeInterface $endAt = null;
  49. /**
  50. * @ORM\Column(type="string", length=255, nullable=true)
  51. */
  52. private ?string $subtitle = null;
  53. /**
  54. * @ORM\Column(type="string", nullable=true)
  55. */
  56. private ?string $mediaUrl = null;
  57. /**
  58. * @ORM\Column(type="boolean", options={"default": false})
  59. */
  60. private bool $isVideo = false;
  61. /**
  62. * @ORM\Column(type="json", nullable=true)
  63. */
  64. private ?array $ctas = null;
  65. /**
  66. * @ORM\Column(type="string", length=255, nullable=true)
  67. */
  68. private ?string $offerId = null;
  69. /**
  70. * @ORM\Column(type="string", length=255, nullable=true)
  71. */
  72. private ?string $companyId = null;
  73. /**
  74. * @ORM\Column(type="string", length=255, nullable=true)
  75. */
  76. private ?string $offerLabelCache = null;
  77. /**
  78. * @ORM\Column(type="string", length=255, nullable=true)
  79. */
  80. private ?string $companyLabelCache = null;
  81. /**
  82. * @ORM\Column(type="json", nullable=true)
  83. */
  84. private ?array $offerPayloadCache = null;
  85. /**
  86. * @ORM\Column(type="json", nullable=true)
  87. */
  88. private ?array $companyPayloadCache = null;
  89. /**
  90. * @ORM\Column(type="json", nullable=true)
  91. */
  92. private ?array $elements = null;
  93. /**
  94. * Mode de distribution sur les webspaces
  95. * @ORM\Column(type="string", length=20)
  96. */
  97. private string $distributionMode = self::DISTRIBUTION_MODE_ALL;
  98. /**
  99. * Liste des webspaces à inclure (si mode INCLUDE)
  100. * @ORM\Column(type="json", nullable=true)
  101. */
  102. private ?array $includeWebspaces = null;
  103. /**
  104. * Liste des webspaces à exclure (si mode ALL_EXCEPT)
  105. * @ORM\Column(type="json", nullable=true)
  106. */
  107. private ?array $excludeWebspaces = null;
  108. /**
  109. * Exclure du site grand public (main-website)
  110. * @ORM\Column(type="boolean", options={"default": false})
  111. */
  112. private bool $isNotMainWebspace = false;
  113. /**
  114. * Propriétés de style (dégradé de couleur, filtre de fond, etc.)
  115. * @ORM\Column(type="json", nullable=true)
  116. */
  117. private ?array $styles = null;
  118. /**
  119. * Contenu pour la page liste (title, short_desc, long_desc)
  120. * @ORM\Column(type="json", nullable=true)
  121. */
  122. private ?array $listPageContent = null;
  123. /**
  124. * @ORM\Column(type="datetime")
  125. */
  126. private ?\DateTimeInterface $created = null;
  127. /**
  128. * @ORM\Column(type="datetime")
  129. */
  130. private ?\DateTimeInterface $updated = null;
  131. public function getId(): ?int
  132. {
  133. return $this->id;
  134. }
  135. public function getTitle(): string
  136. {
  137. return $this->title;
  138. }
  139. public function setTitle(string $title): self
  140. {
  141. $this->title = $title;
  142. return $this;
  143. }
  144. public function getType(): ?string
  145. {
  146. return $this->type;
  147. }
  148. public function setType(?string $type): self
  149. {
  150. $this->type = $type;
  151. return $this;
  152. }
  153. public function getPosition(): int
  154. {
  155. return $this->position;
  156. }
  157. public function setPosition(int $position): self
  158. {
  159. $this->position = $position;
  160. return $this;
  161. }
  162. public function isActive(): bool
  163. {
  164. return $this->active;
  165. }
  166. public function setActive(bool $active): self
  167. {
  168. $this->active = $active;
  169. return $this;
  170. }
  171. public function getStartAt(): ?\DateTimeInterface
  172. {
  173. return $this->startAt;
  174. }
  175. public function setStartAt(?\DateTimeInterface $startAt): self
  176. {
  177. $this->startAt = $startAt;
  178. return $this;
  179. }
  180. public function getEndAt(): ?\DateTimeInterface
  181. {
  182. return $this->endAt;
  183. }
  184. public function setEndAt(?\DateTimeInterface $endAt): self
  185. {
  186. $this->endAt = $endAt;
  187. return $this;
  188. }
  189. public function getSubtitle(): ?string
  190. {
  191. return $this->subtitle;
  192. }
  193. public function setSubtitle(?string $subtitle): self
  194. {
  195. $this->subtitle = $subtitle;
  196. return $this;
  197. }
  198. public function getMediaUrl(): ?string
  199. {
  200. return $this->mediaUrl;
  201. }
  202. public function setMediaUrl(?string $mediaUrl): self
  203. {
  204. $this->mediaUrl = $mediaUrl;
  205. return $this;
  206. }
  207. public function isVideo(): bool
  208. {
  209. return $this->isVideo;
  210. }
  211. public function setIsVideo(bool $isVideo): self
  212. {
  213. $this->isVideo = $isVideo;
  214. return $this;
  215. }
  216. public function getCompanyId(): ?string
  217. {
  218. return $this->companyId;
  219. }
  220. public function setCompanyId(?string $companyId): self
  221. {
  222. $this->companyId = $companyId;
  223. return $this;
  224. }
  225. public function getCtas(): ?array
  226. {
  227. return $this->ctas;
  228. }
  229. public function setCtas(?array $ctas): self
  230. {
  231. $this->ctas = $ctas;
  232. return $this;
  233. }
  234. public function getOfferId(): ?string
  235. {
  236. return $this->offerId;
  237. }
  238. public function setOfferId(?string $offerId): self
  239. {
  240. $this->offerId = $offerId;
  241. return $this;
  242. }
  243. public function getOfferLabelCache(): ?string
  244. {
  245. return $this->offerLabelCache;
  246. }
  247. public function setOfferLabelCache(?string $offerLabelCache): self
  248. {
  249. $this->offerLabelCache = $offerLabelCache;
  250. return $this;
  251. }
  252. public function getCompanyLabelCache(): ?string
  253. {
  254. return $this->companyLabelCache;
  255. }
  256. public function setCompanyLabelCache(?string $companyLabelCache): self
  257. {
  258. $this->companyLabelCache = $companyLabelCache;
  259. return $this;
  260. }
  261. public function getOfferPayloadCache(): ?array
  262. {
  263. return $this->offerPayloadCache;
  264. }
  265. public function setOfferPayloadCache(?array $offerPayloadCache): self
  266. {
  267. $this->offerPayloadCache = $offerPayloadCache;
  268. return $this;
  269. }
  270. public function getCompanyPayloadCache(): ?array
  271. {
  272. return $this->companyPayloadCache;
  273. }
  274. public function setCompanyPayloadCache(?array $companyPayloadCache): self
  275. {
  276. $this->companyPayloadCache = $companyPayloadCache;
  277. return $this;
  278. }
  279. public function getElements(): ?array
  280. {
  281. return $this->elements;
  282. }
  283. public function setElements(?array $elements): self
  284. {
  285. $this->elements = $elements;
  286. return $this;
  287. }
  288. public function getDistributionMode(): string
  289. {
  290. return $this->distributionMode;
  291. }
  292. public function setDistributionMode(string $distributionMode): self
  293. {
  294. $this->distributionMode = $distributionMode;
  295. return $this;
  296. }
  297. public function getIncludeWebspaces(): ?array
  298. {
  299. return $this->includeWebspaces;
  300. }
  301. public function setIncludeWebspaces(?array $includeWebspaces): self
  302. {
  303. $this->includeWebspaces = $includeWebspaces;
  304. return $this;
  305. }
  306. public function getExcludeWebspaces(): ?array
  307. {
  308. return $this->excludeWebspaces;
  309. }
  310. public function setExcludeWebspaces(?array $excludeWebspaces): self
  311. {
  312. $this->excludeWebspaces = $excludeWebspaces;
  313. return $this;
  314. }
  315. public function isNotMainWebspace(): bool
  316. {
  317. return $this->isNotMainWebspace;
  318. }
  319. public function setIsNotMainWebspace(bool $isNotMainWebspace): self
  320. {
  321. $this->isNotMainWebspace = $isNotMainWebspace;
  322. return $this;
  323. }
  324. public function getStyles(): ?array
  325. {
  326. return $this->styles;
  327. }
  328. public function setStyles(?array $styles): self
  329. {
  330. $this->styles = $styles;
  331. return $this;
  332. }
  333. public function getListPageContent(): ?array
  334. {
  335. return $this->listPageContent;
  336. }
  337. public function setListPageContent(?array $listPageContent): self
  338. {
  339. $this->listPageContent = $listPageContent;
  340. return $this;
  341. }
  342. public function getCreated(): ?\DateTimeInterface
  343. {
  344. return $this->created;
  345. }
  346. public function setCreated(\DateTimeInterface $created): self
  347. {
  348. $this->created = $created;
  349. return $this;
  350. }
  351. public function getUpdated(): ?\DateTimeInterface
  352. {
  353. return $this->updated;
  354. }
  355. public function setUpdated(\DateTimeInterface $updated): self
  356. {
  357. $this->updated = $updated;
  358. return $this;
  359. }
  360. /**
  361. * @ORM\PrePersist
  362. */
  363. public function onPrePersist(): void
  364. {
  365. $now = new \DateTime();
  366. $this->created = $now;
  367. $this->updated = $now;
  368. }
  369. /**
  370. * @ORM\PreUpdate
  371. */
  372. public function onPreUpdate(): void
  373. {
  374. $this->updated = new \DateTime();
  375. }
  376. }