<?phpnamespace App\Core\Entity\Chat;use App\Core\Entity\User;use App\Core\Repository\Chat\ParticipanteRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=ParticipanteRepository::class) */class Participante{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=Conversacion::class, inversedBy="participantes") * @ORM\JoinColumn(nullable=false) */ private $conversacion; /** * @ORM\Column(type="boolean", nullable=true) */ private $administrador; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="participacionesChat") * @ORM\JoinColumn(nullable=false) */ private $usuario; /** * @ORM\Column(type="datetime", nullable=true) */ private $mensajesLeidosAt; /** * @ORM\OneToMany(targetEntity=Mensaje::class, mappedBy="participante", orphanRemoval=true) */ private $mensajes; public function __construct() { $this->mensajes = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getConversacion(): ?Conversacion { return $this->conversacion; } public function setConversacion(?Conversacion $conversacion): self { $this->conversacion = $conversacion; return $this; } public function getAdministrador(): ?bool { return $this->administrador; } public function setAdministrador(?bool $administrador): self { $this->administrador = $administrador; return $this; } public function getUsuario(): ?User { return $this->usuario; } public function setUsuario(?User $usuario): self { $this->usuario = $usuario; return $this; } public function getMensajesLeidosAt(): ?\DateTimeInterface { return $this->mensajesLeidosAt; } public function setMensajesLeidosAt(?\DateTimeInterface $mensajesLeidosAt): self { $this->mensajesLeidosAt = $mensajesLeidosAt; return $this; } /** * @return Collection|Mensaje[] */ public function getMensajes(): Collection { return $this->mensajes; } public function addMensaje(Mensaje $mensaje): self { if (!$this->mensajes->contains($mensaje)) { $this->mensajes[] = $mensaje; $mensaje->setParticipante($this); } return $this; } public function removeMensaje(Mensaje $mensaje): self { if ($this->mensajes->contains($mensaje)) { $this->mensajes->removeElement($mensaje); // set the owning side to null (unless already changed) if ($mensaje->getParticipante() === $this) { $mensaje->setParticipante(null); } } return $this; }}