<?php
namespace App\Entity;
use Symfony\Component\Uid\Uuid;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\SujetRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity(repositoryClass=SujetRepository::class)
*/
class Sujet
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $uuid;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $token;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $nom;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $reponse = 1;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $locked = false;
public $last;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="sujets")
*/
private $user;
/**
* @ORM\OneToMany(targetEntity=Message::class, mappedBy="sujet", cascade={"persist", "remove"})
*/
private $messages;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $slug;
/**
* @ORM\ManyToOne(targetEntity=Position::class, inversedBy="sujets")
*/
private $position;
/**
* @ORM\ManyToOne(targetEntity=Groupe::class, inversedBy="sujets")
*/
private $groupe;
public function __construct()
{
$this->messages = new ArrayCollection();
$this->uuid = Uuid::v4();
}
public function getId(): ?int
{
return $this->id;
}
public function getUuid(): ?string
{
return $this->uuid;
}
public function setUuid(?string $uuid): self
{
$this->uuid = $uuid;
return $this;
}
public function getToken(): ?string
{
return $this->token;
}
public function setToken(?string $token): self
{
$this->token = $token;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(?string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getReponse(): ?int
{
return $this->reponse;
}
public function setReponse(?int $reponse): self
{
$this->reponse = $reponse;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function isLocked(): ?bool
{
return $this->locked;
}
public function setLocked(?bool $locked): self
{
$this->locked = $locked;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
/**
* @return Collection<int, Message>
*/
public function getMessages(): Collection
{
return $this->messages;
}
public function addMessage(Message $message): self
{
if (!$this->messages->contains($message)) {
$this->messages[] = $message;
$message->setSujet($this);
}
return $this;
}
public function removeMessage(Message $message): self
{
if ($this->messages->removeElement($message)) {
// set the owning side to null (unless already changed)
if ($message->getSujet() === $this) {
$message->setSujet(null);
}
}
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getPosition(): ?Position
{
return $this->position;
}
public function setPosition(?Position $position): self
{
$this->position = $position;
return $this;
}
public function getGroupe(): ?Groupe
{
return $this->groupe;
}
public function setGroupe(?Groupe $groupe): self
{
$this->groupe = $groupe;
return $this;
}
}