src/JuridicusBundle/Entity/Faq.php line 12

Open in your IDE?
  1. <?php
  2. namespace JF\JuridicusBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. /**
  7. * Faq
  8. */
  9. class Faq
  10. {
  11. const CLASSNAME = __CLASS__;
  12. /**
  13. * @var integer
  14. */
  15. private $id;
  16. /**
  17. * @var integer
  18. */
  19. private $sortierung = 0;
  20. /**
  21. * @var string
  22. * @Assert\NotBlank
  23. */
  24. private $frage;
  25. /**
  26. * @var string
  27. * @Assert\NotBlank
  28. */
  29. private $antwort;
  30. /**
  31. * @var \DateTime
  32. * @Assert\Type(\DateTimeInterface::class)
  33. */
  34. private $created_at;
  35. /**
  36. * @var \DateTime
  37. * @Assert\Type(\DateTimeInterface::class)
  38. */
  39. private $updated_at;
  40. public function __construct()
  41. {
  42. $this->created_at = new \DateTime();
  43. $this->updated_at = new \DateTime();
  44. }
  45. /**
  46. * Get id
  47. *
  48. * @return integer
  49. */
  50. public function getId()
  51. {
  52. return $this->id;
  53. }
  54. /**
  55. * Set sortierung
  56. *
  57. * @param integer $sortierung
  58. * @return Faq
  59. */
  60. public function setSortierung($sortierung)
  61. {
  62. $this->sortierung = $sortierung;
  63. return $this;
  64. }
  65. /**
  66. * Get sortierung
  67. *
  68. * @return integer
  69. */
  70. public function getSortierung()
  71. {
  72. return $this->sortierung;
  73. }
  74. /**
  75. * Set frage
  76. *
  77. * @param string $frage
  78. * @return Faq
  79. */
  80. public function setFrage($frage)
  81. {
  82. $this->frage = $frage;
  83. return $this;
  84. }
  85. /**
  86. * Get frage
  87. *
  88. * @return string
  89. */
  90. public function getFrage()
  91. {
  92. return $this->frage;
  93. }
  94. /**
  95. * Set antwort
  96. *
  97. * @param string $antwort
  98. * @return Faq
  99. */
  100. public function setAntwort($antwort)
  101. {
  102. $this->antwort = $antwort;
  103. return $this;
  104. }
  105. /**
  106. * Get antwort
  107. *
  108. * @return string
  109. */
  110. public function getAntwort()
  111. {
  112. return $this->antwort;
  113. }
  114. /**
  115. * Set created_at
  116. *
  117. * @param \DateTime $createdAt
  118. * @return Faq
  119. */
  120. public function setCreatedAt($createdAt)
  121. {
  122. $this->created_at = $createdAt;
  123. return $this;
  124. }
  125. /**
  126. * Get created_at
  127. *
  128. * @return \DateTime
  129. */
  130. public function getCreatedAt()
  131. {
  132. return $this->created_at;
  133. }
  134. /**
  135. * Set updated_at
  136. *
  137. * @param \DateTime $updatedAt
  138. * @return Faq
  139. */
  140. public function setUpdatedAt($updatedAt)
  141. {
  142. $this->updated_at = $updatedAt;
  143. return $this;
  144. }
  145. /**
  146. * Get updated_at
  147. *
  148. * @return \DateTime
  149. */
  150. public function getUpdatedAt()
  151. {
  152. return $this->updated_at;
  153. }
  154. public function __toString()
  155. {
  156. return sprintf('FAQ Item #%d', $this->getSortierung());
  157. }
  158. /**
  159. * @param array replacements
  160. * @return string
  161. */
  162. public function antwortReplace( array $replacements )
  163. {
  164. $body = $this->antwort;
  165. if ( isset( $replacements['host'] ) )
  166. {
  167. $body = str_replace('[HOST]', sprintf( '<a href="http://%1$s">%1$s</a>', $replacements['host'] ), $body);
  168. }
  169. if ( isset( $replacements['anzahl_pruefer'] ) )
  170. {
  171. $body = str_replace('[ANZAHL_PRUEFER]',$replacements['anzahl_pruefer'], $body);
  172. }
  173. return $body;
  174. }
  175. }