src/Entity/MensajeForo.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity
  9. */
  10. class MensajeForo extends BaseEntity
  11. {
  12. /**
  13. * @ORM\Id
  14. * @ORM\Column(type="integer")
  15. * @ORM\GeneratedValue(strategy="AUTO")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\Column(type="text", nullable=true)
  20. */
  21. private $contenido;
  22. /**
  23. * @ORM\Column(type="datetime", nullable=true)
  24. */
  25. private $createdAt;
  26. /**
  27. * @ORM\Column(type="datetime", nullable=true)
  28. */
  29. private $updatedAt;
  30. /**
  31. * @ORM\Column(type="boolean", nullable=true)
  32. */
  33. private $editado;
  34. /**
  35. * @ORM\ManyToOne(targetEntity=\App\Entity\Tema::class, inversedBy="mensajeForos")
  36. * @ORM\JoinColumn(name="tema_id", referencedColumnName="id")
  37. */
  38. private $tema;
  39. /**
  40. * @ORM\ManyToOne(targetEntity=\App\Entity\PropietarioContenido::class, inversedBy="mensajeForos")
  41. * @ORM\JoinColumn(name="propietario_contenido_id", referencedColumnName="id")
  42. */
  43. private $propietarioContenido;
  44. /**
  45. * @ORM\ManyToOne(targetEntity=\App\Entity\MensajeForo::class, inversedBy="respuestas")
  46. * @ORM\JoinColumn(name="padre_id", referencedColumnName="id")
  47. */
  48. private $padre;
  49. /**
  50. * @ORM\OneToMany(targetEntity=\App\Entity\MensajeForo::class, mappedBy="padre")
  51. */
  52. private $respuestas;
  53. /**
  54. * @ORM\OneToMany(targetEntity=\App\Entity\MensajeLeidoForo::class, mappedBy="mensaje", cascade={"remove"})
  55. */
  56. private $mensajeLeidoForos;
  57. public function __construct()
  58. {
  59. $this->respuestas = new \Doctrine\Common\Collections\ArrayCollection();
  60. }
  61. public function getId(): ?int
  62. {
  63. return $this->id;
  64. }
  65. public function setId($id)
  66. {
  67. $this->id = $id;
  68. return $this;
  69. }
  70. public function getContenido(): ?string
  71. {
  72. return $this->contenido;
  73. }
  74. public function setContenido(?string $contenido): static
  75. {
  76. $this->contenido = $contenido;
  77. return $this;
  78. }
  79. public function getCreatedAt(): ?\DateTimeInterface
  80. {
  81. return $this->createdAt;
  82. }
  83. public function setCreatedAt(?\DateTimeInterface $createdAt): static
  84. {
  85. $this->createdAt = $createdAt;
  86. return $this;
  87. }
  88. public function getUpdatedAt(): ?\DateTimeInterface
  89. {
  90. return $this->updatedAt;
  91. }
  92. public function setUpdatedAt(?\DateTimeInterface $updatedAt): static
  93. {
  94. $this->updatedAt = $updatedAt;
  95. return $this;
  96. }
  97. public function isEditado(): ?bool
  98. {
  99. return $this->editado;
  100. }
  101. public function setEditado(?bool $editado): static
  102. {
  103. $this->editado = $editado;
  104. return $this;
  105. }
  106. public function getTema(): ?Tema
  107. {
  108. return $this->tema;
  109. }
  110. public function setTema(?Tema $tema): static
  111. {
  112. $this->tema = $tema;
  113. return $this;
  114. }
  115. public function getPropietarioContenido(): ?PropietarioContenido
  116. {
  117. return $this->propietarioContenido;
  118. }
  119. public function setPropietarioContenido(?PropietarioContenido $propietarioContenido): static
  120. {
  121. $this->propietarioContenido = $propietarioContenido;
  122. return $this;
  123. }
  124. public function getPadre(): ?self
  125. {
  126. return $this->padre;
  127. }
  128. public function setPadre(?self $padre): static
  129. {
  130. $this->padre = $padre;
  131. return $this;
  132. }
  133. public function getRespuestas(): \Doctrine\Common\Collections\Collection
  134. {
  135. return $this->respuestas;
  136. }
  137. public function addRespuesta(self $respuesta): static
  138. {
  139. if (!$this->respuestas->contains($respuesta)) {
  140. $this->respuestas[] = $respuesta;
  141. $respuesta->setPadre($this);
  142. }
  143. return $this;
  144. }
  145. public function removeRespuesta(self $respuesta): static
  146. {
  147. if ($this->respuestas->removeElement($respuesta)) {
  148. // set the owning side to null (unless already changed)
  149. if ($respuesta->getPadre() === $this) {
  150. $respuesta->setPadre(null);
  151. }
  152. }
  153. return $this;
  154. }
  155. }