src/Entity/Popup.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PopupRepository;
  4. use DateTime;
  5. use DateTimeInterface;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use JMS\Serializer\Annotation as Serializer;
  8. use JMS\Serializer\Annotation\Expose;
  9. use JMS\Serializer\Annotation\Groups;
  10. /**
  11. * @ORM\Entity(repositoryClass=PopupRepository::class)
  12. *
  13. * @Serializer\ExclusionPolicy("ALL")
  14. */
  15. class Popup
  16. {
  17. /**
  18. * @ORM\Id
  19. * @ORM\GeneratedValue
  20. * @ORM\Column(type="integer")
  21. *
  22. * @Expose
  23. * @Groups({"popup_list"})
  24. */
  25. private $id;
  26. /**
  27. * @ORM\Column(type="string", length=255)
  28. *
  29. * @Expose
  30. * @Groups({"popup_list"})
  31. */
  32. private $title;
  33. /**
  34. * @ORM\Column(type="text")
  35. *
  36. * @Expose
  37. * @Groups({"popup_list"})
  38. */
  39. private $content;
  40. /**
  41. * @ORM\Column(type="string", length=255, nullable=true)
  42. *
  43. * @Expose
  44. * @Groups({"popup_list"})
  45. */
  46. private $linkUrl;
  47. /**
  48. * @ORM\Column(type="boolean")
  49. *
  50. * @Expose
  51. * @Groups({"popup_list"})
  52. */
  53. private $external;
  54. /**
  55. * @ORM\Column(type="datetime", nullable=true)
  56. *
  57. * @Expose
  58. * @Groups({"popup_list"})
  59. */
  60. private $dateStart;
  61. /**
  62. * @ORM\Column(type="datetime", nullable=true)
  63. *
  64. * @Expose
  65. * @Groups({"popup_list"})
  66. */
  67. private $dateEnd;
  68. /**
  69. * @ORM\Column(type="boolean")
  70. */
  71. private $enabled;
  72. /**
  73. * @ORM\Column(type="string", length=255, nullable=true)
  74. */
  75. private $displayRole;
  76. /**
  77. * @ORM\Column(type="string", length=255, nullable=true)
  78. */
  79. private $displayJob;
  80. public function __construct()
  81. {
  82. $this->enabled = TRUE;
  83. $this->external = FALSE;
  84. $this->dateStart = new DateTime();
  85. $this->dateEnd = new DateTime( '+1 month' );
  86. }
  87. public function getId(): ?int
  88. {
  89. return $this->id;
  90. }
  91. public function getTitle(): ?string
  92. {
  93. return $this->title;
  94. }
  95. public function setTitle( string $title ): self
  96. {
  97. $this->title = $title;
  98. return $this;
  99. }
  100. public function getContent(): ?string
  101. {
  102. return $this->content;
  103. }
  104. public function setContent( string $content ): self
  105. {
  106. $this->content = $content;
  107. return $this;
  108. }
  109. public function getLinkUrl(): ?string
  110. {
  111. return $this->linkUrl;
  112. }
  113. public function setLinkUrl( ?string $linkUrl ): self
  114. {
  115. $this->linkUrl = $linkUrl;
  116. return $this;
  117. }
  118. public function getExternal(): ?bool
  119. {
  120. return $this->external;
  121. }
  122. public function setExternal( bool $external ): self
  123. {
  124. $this->external = $external;
  125. return $this;
  126. }
  127. public function getDateStart(): ?DateTimeInterface
  128. {
  129. return $this->dateStart;
  130. }
  131. public function setDateStart( ?DateTimeInterface $dateStart ): self
  132. {
  133. $this->dateStart = $dateStart;
  134. return $this;
  135. }
  136. public function getDateEnd(): ?DateTimeInterface
  137. {
  138. return $this->dateEnd;
  139. }
  140. public function setDateEnd( ?DateTimeInterface $dateEnd ): self
  141. {
  142. $this->dateEnd = $dateEnd;
  143. return $this;
  144. }
  145. public function getEnabled(): ?bool
  146. {
  147. return $this->enabled;
  148. }
  149. public function setEnabled( bool $enabled ): self
  150. {
  151. $this->enabled = $enabled;
  152. return $this;
  153. }
  154. public function getDisplayRole(): ?array
  155. {
  156. if ( $this->displayRole === NULL ) {
  157. return $this->displayRole;
  158. }
  159. return explode( ';', $this->displayRole );
  160. }
  161. public function setDisplayRole( ?array $displayRole ): self
  162. {
  163. if (!$displayRole || $displayRole === [] ) {
  164. $this->displayRole = NULL;
  165. } else {
  166. $this->displayRole = implode( ';', $displayRole );
  167. }
  168. return $this;
  169. }
  170. public function getDisplayJob(): ?array
  171. {
  172. if ( $this->displayJob === NULL ) {
  173. return $this->displayJob;
  174. }
  175. return explode( ';', $this->displayJob );
  176. }
  177. public function setDisplayJob( ?array $displayJob ): self
  178. {
  179. if ( !$displayJob || $displayJob === [] ) {
  180. $this->displayJob = NULL;
  181. } else {
  182. $this->displayJob = implode( ';', $displayJob );
  183. }
  184. return $this;
  185. }
  186. }