<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class MensajeForo extends BaseEntity
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $contenido;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $editado;
/**
* @ORM\ManyToOne(targetEntity=\App\Entity\Tema::class, inversedBy="mensajeForos")
* @ORM\JoinColumn(name="tema_id", referencedColumnName="id")
*/
private $tema;
/**
* @ORM\ManyToOne(targetEntity=\App\Entity\PropietarioContenido::class, inversedBy="mensajeForos")
* @ORM\JoinColumn(name="propietario_contenido_id", referencedColumnName="id")
*/
private $propietarioContenido;
/**
* @ORM\ManyToOne(targetEntity=\App\Entity\MensajeForo::class, inversedBy="respuestas")
* @ORM\JoinColumn(name="padre_id", referencedColumnName="id")
*/
private $padre;
/**
* @ORM\OneToMany(targetEntity=\App\Entity\MensajeForo::class, mappedBy="padre")
*/
private $respuestas;
/**
* @ORM\OneToMany(targetEntity=\App\Entity\MensajeLeidoForo::class, mappedBy="mensaje", cascade={"remove"})
*/
private $mensajeLeidoForos;
public function __construct()
{
$this->respuestas = new \Doctrine\Common\Collections\ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId($id)
{
$this->id = $id;
return $this;
}
public function getContenido(): ?string
{
return $this->contenido;
}
public function setContenido(?string $contenido): static
{
$this->contenido = $contenido;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): static
{
$this->updatedAt = $updatedAt;
return $this;
}
public function isEditado(): ?bool
{
return $this->editado;
}
public function setEditado(?bool $editado): static
{
$this->editado = $editado;
return $this;
}
public function getTema(): ?Tema
{
return $this->tema;
}
public function setTema(?Tema $tema): static
{
$this->tema = $tema;
return $this;
}
public function getPropietarioContenido(): ?PropietarioContenido
{
return $this->propietarioContenido;
}
public function setPropietarioContenido(?PropietarioContenido $propietarioContenido): static
{
$this->propietarioContenido = $propietarioContenido;
return $this;
}
public function getPadre(): ?self
{
return $this->padre;
}
public function setPadre(?self $padre): static
{
$this->padre = $padre;
return $this;
}
public function getRespuestas(): \Doctrine\Common\Collections\Collection
{
return $this->respuestas;
}
public function addRespuesta(self $respuesta): static
{
if (!$this->respuestas->contains($respuesta)) {
$this->respuestas[] = $respuesta;
$respuesta->setPadre($this);
}
return $this;
}
public function removeRespuesta(self $respuesta): static
{
if ($this->respuestas->removeElement($respuesta)) {
// set the owning side to null (unless already changed)
if ($respuesta->getPadre() === $this) {
$respuesta->setPadre(null);
}
}
return $this;
}
}