src/Entity/ForumSujet.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ForumSujetRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=ForumSujetRepository::class)
  9. */
  10. class ForumSujet
  11. {
  12. /**
  13. * @ORM\Id
  14. * @ORM\GeneratedValue
  15. * @ORM\Column(type="integer")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\Column(type="string", length=255)
  20. */
  21. private $titre;
  22. /**
  23. * @ORM\ManyToOne(targetEntity=User::class, inversedBy="forumSujets")
  24. * @ORM\JoinColumn(nullable=false)
  25. */
  26. private $auteur;
  27. /**
  28. * @ORM\Column(type="text")
  29. */
  30. private $contenu;
  31. /**
  32. * @ORM\Column(type="datetime")
  33. */
  34. private $date;
  35. /**
  36. * @ORM\ManyToOne(targetEntity=Province::class, inversedBy="forumSujets")
  37. * @ORM\JoinColumn(nullable=false)
  38. */
  39. private $province;
  40. /**
  41. * @ORM\OneToMany(targetEntity=ForumMessage::class, mappedBy="forumSujet")
  42. */
  43. private $messages;
  44. /**
  45. * @ORM\ManyToOne(targetEntity=ForumCategorie::class, inversedBy="sujets")
  46. */
  47. private $categorie;
  48. public function __construct()
  49. {
  50. $this->messages = new ArrayCollection();
  51. }
  52. public function getId(): ?int
  53. {
  54. return $this->id;
  55. }
  56. public function getTitre(): ?string
  57. {
  58. return $this->titre;
  59. }
  60. public function setTitre(string $titre): self
  61. {
  62. $this->titre = $titre;
  63. return $this;
  64. }
  65. public function getAuteur(): ?User
  66. {
  67. return $this->auteur;
  68. }
  69. public function setAuteur(?User $auteur): self
  70. {
  71. $this->auteur = $auteur;
  72. return $this;
  73. }
  74. public function getContenu(): ?string
  75. {
  76. return $this->contenu;
  77. }
  78. public function setContenu(string $contenu): self
  79. {
  80. $this->contenu = $contenu;
  81. return $this;
  82. }
  83. public function getDate(): ?\DateTimeInterface
  84. {
  85. return $this->date;
  86. }
  87. public function setDate(\DateTimeInterface $date): self
  88. {
  89. $this->date = $date;
  90. return $this;
  91. }
  92. public function getProvince(): ?Province
  93. {
  94. return $this->province;
  95. }
  96. public function setProvince(?Province $province): self
  97. {
  98. $this->province = $province;
  99. return $this;
  100. }
  101. /**
  102. * @return Collection<int, ForumMessage>
  103. */
  104. public function getMessages(): Collection
  105. {
  106. return $this->messages;
  107. }
  108. public function addMessage(ForumMessage $message): self
  109. {
  110. if (!$this->messages->contains($message)) {
  111. $this->messages[] = $message;
  112. $message->setForumSujet($this);
  113. }
  114. return $this;
  115. }
  116. public function removeMessage(ForumMessage $message): self
  117. {
  118. if ($this->messages->removeElement($message)) {
  119. // set the owning side to null (unless already changed)
  120. if ($message->getForumSujet() === $this) {
  121. $message->setForumSujet(null);
  122. }
  123. }
  124. return $this;
  125. }
  126. public function getCategorie(): ?ForumCategorie
  127. {
  128. return $this->categorie;
  129. }
  130. public function setCategorie(?ForumCategorie $categorie): self
  131. {
  132. $this->categorie = $categorie;
  133. return $this;
  134. }
  135. }