src/Entity/Faq.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Traits\DateTrait;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use JMS\Serializer\Annotation\Groups;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8. * @ORM\Entity
  9. * @ORM\HasLifecycleCallbacks
  10. */
  11. class Faq
  12. {
  13. const MODULE_NAME = 'faq';
  14. const LIBELLE_CACHE = 'liste_all_faq';
  15. use DateTrait;
  16. /**
  17. * @ORM\Id
  18. * @ORM\GeneratedValue
  19. * @ORM\Column(type="integer")
  20. *
  21. * @Groups({"faq"})
  22. */
  23. private ?int $id = null;
  24. /**
  25. * @ORM\Column(type="string")
  26. * @Groups({"faq"})
  27. *
  28. * @Assert\NotBlank
  29. */
  30. private string $theme = '';
  31. /**
  32. * @ORM\Column(type="string")
  33. * @Groups({"faq"})
  34. *
  35. * @Assert\NotBlank
  36. */
  37. private string $question = '';
  38. /**
  39. * @ORM\Column(type="string")
  40. * @Groups({"faq"})
  41. */
  42. private string $questionNormalized = '';
  43. /**
  44. * @ORM\Column(type="string", nullable=true)
  45. * @Groups({"faq"})
  46. */
  47. private ?string $question2 = null;
  48. /**
  49. * @ORM\Column(type="string", nullable=true)
  50. * @Groups({"faq"})
  51. */
  52. private ?string $question2Normalized = null;
  53. /**
  54. * @ORM\Column(type="string", nullable=true)
  55. * @Groups({"faq"})
  56. */
  57. private ?string $question3 = null;
  58. /**
  59. * @ORM\Column(type="string", nullable=true)
  60. * @Groups({"faq"})
  61. */
  62. private ?string $question3Normalized = null;
  63. /**
  64. * @ORM\Column(type="text")
  65. * @Groups({"faq"})
  66. *
  67. * @Assert\NotBlank
  68. */
  69. private string $answer = '';
  70. /**
  71. * @return int|null
  72. */
  73. public function getId(): ?int
  74. {
  75. return $this->id;
  76. }
  77. /**
  78. * @param int|null $id
  79. * @return Faq
  80. */
  81. public function setId(?int $id): Faq
  82. {
  83. $this->id = $id;
  84. return $this;
  85. }
  86. /**
  87. * @return string
  88. */
  89. public function getQuestion(): string
  90. {
  91. return $this->question;
  92. }
  93. /**
  94. * @param string $question
  95. * @return Faq
  96. */
  97. public function setQuestion(string $question): Faq
  98. {
  99. $this->question = $question;
  100. return $this;
  101. }
  102. /**
  103. * @return string
  104. */
  105. public function getQuestionNormalized(): string
  106. {
  107. return $this->questionNormalized;
  108. }
  109. /**
  110. * @param string $questionNormalized
  111. * @return Faq
  112. */
  113. public function setQuestionNormalized(string $questionNormalized): Faq
  114. {
  115. $this->questionNormalized = $questionNormalized;
  116. return $this;
  117. }
  118. /**
  119. * @return string|null
  120. */
  121. public function getQuestion2(): ?string
  122. {
  123. return $this->question2;
  124. }
  125. /**
  126. * @param string|null $question2
  127. * @return Faq
  128. */
  129. public function setQuestion2(?string $question2): Faq
  130. {
  131. $this->question2 = $question2;
  132. return $this;
  133. }
  134. /**
  135. * @return string|null
  136. */
  137. public function getQuestion2Normalized(): ?string
  138. {
  139. return $this->question2Normalized;
  140. }
  141. /**
  142. * @param string|null $question2Normalized
  143. * @return Faq
  144. */
  145. public function setQuestion2Normalized(?string $question2Normalized): Faq
  146. {
  147. $this->question2Normalized = $question2Normalized;
  148. return $this;
  149. }
  150. /**
  151. * @return string|null
  152. */
  153. public function getQuestion3(): ?string
  154. {
  155. return $this->question3;
  156. }
  157. /**
  158. * @param string|null $question3
  159. * @return Faq
  160. */
  161. public function setQuestion3(?string $question3): Faq
  162. {
  163. $this->question3 = $question3;
  164. return $this;
  165. }
  166. /**
  167. * @return string|null
  168. */
  169. public function getQuestion3Normalized(): ?string
  170. {
  171. return $this->question3Normalized;
  172. }
  173. /**
  174. * @param string|null $question3Normalized
  175. * @return Faq
  176. */
  177. public function setQuestion3Normalized(?string $question3Normalized): Faq
  178. {
  179. $this->question3Normalized = $question3Normalized;
  180. return $this;
  181. }
  182. /**
  183. * @return string
  184. */
  185. public function getAnswer(): string
  186. {
  187. return $this->answer;
  188. }
  189. /**
  190. * @param string $answer
  191. * @return Faq
  192. */
  193. public function setAnswer(string $answer): Faq
  194. {
  195. $this->answer = $answer;
  196. return $this;
  197. }
  198. /**
  199. * @return array
  200. */
  201. public function getNormalizedQuestions(): array
  202. {
  203. $questions = [];
  204. if(!empty($this->questionNormalized)) $questions[$this->question] = $this->questionNormalized;
  205. if(!empty($this->question2Normalized)) $questions[$this->question2] = $this->question2Normalized;
  206. if(!empty($this->question3Normalized)) $questions[$this->question3] = $this->question3Normalized;
  207. return $questions;
  208. }
  209. /**
  210. * @return string
  211. */
  212. public function getTheme(): string
  213. {
  214. return $this->theme;
  215. }
  216. /**
  217. * @param string $theme
  218. * @return Faq
  219. */
  220. public function setTheme(string $theme): Faq
  221. {
  222. $this->theme = $theme;
  223. return $this;
  224. }
  225. }