src/Entity/FaqAnswer.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FaqAnswerRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=FaqAnswerRepository::class)
  9. */
  10. class FaqAnswer extends BaseEntity
  11. {
  12. /**
  13. * @ORM\Id
  14. * @ORM\GeneratedValue
  15. * @ORM\Column(type="integer")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\ManyToMany(targetEntity=FaqQuestion::class, mappedBy="faqAnswers")
  20. */
  21. private $faqQuestions;
  22. /**
  23. * @ORM\Column(type="text")
  24. */
  25. private $answer;
  26. public function __construct()
  27. {
  28. $this->faqQuestions = new ArrayCollection();
  29. }
  30. public function getId(): ?int
  31. {
  32. return $this->id;
  33. }
  34. /**
  35. * @return Collection<int, FaqQuestion>
  36. */
  37. public function getFaqQuestions(): Collection
  38. {
  39. return $this->faqQuestions;
  40. }
  41. public function addFaqQuestion(FaqQuestion $faqQuestion): self
  42. {
  43. if (!$this->faqQuestions->contains($faqQuestion)) {
  44. $this->faqQuestions[] = $faqQuestion;
  45. $faqQuestion->addFaqAnswer($this);
  46. }
  47. return $this;
  48. }
  49. public function removeFaqQuestion(FaqQuestion $faqQuestion): self
  50. {
  51. if ($this->faqQuestions->removeElement($faqQuestion)) {
  52. $faqQuestion->removeFaqAnswer($this);
  53. }
  54. return $this;
  55. }
  56. public function getAnswer(): ?string
  57. {
  58. return $this->answer;
  59. }
  60. public function setAnswer(string $answer): self
  61. {
  62. $this->answer = $answer;
  63. return $this;
  64. }
  65. }