<?php
namespace App\Entity;
use Symfony\Component\Uid\Uuid;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use App\Repository\ClassificationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass=ClassificationRepository::class)
* @UniqueEntity(fields={"nom"}, message="Cette classification existe déjà")
*/
class Classification
{
/**
* @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 $slug;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $statut = false;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $nom;
/**
* @ORM\OneToMany(targetEntity=Actualite::class, mappedBy="classification")
*/
private $actualites;
public function __construct()
{
$this->uuid = Uuid::v4();
$this->actualites = new ArrayCollection();
}
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 getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function isStatut(): ?bool
{
return $this->statut;
}
public function setStatut(?bool $statut): self
{
$this->statut = $statut;
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 getNom(): ?string
{
return $this->nom;
}
public function setNom(?string $nom): self
{
$this->nom = $nom;
return $this;
}
/**
* @return Collection<int, Actualite>
*/
public function getActualites(): Collection
{
return $this->actualites;
}
public function addActualite(Actualite $actualite): self
{
if (!$this->actualites->contains($actualite)) {
$this->actualites[] = $actualite;
$actualite->setClassification($this);
}
return $this;
}
public function removeActualite(Actualite $actualite): self
{
if ($this->actualites->removeElement($actualite)) {
// set the owning side to null (unless already changed)
if ($actualite->getClassification() === $this) {
$actualite->setClassification(null);
}
}
return $this;
}
}