<?php
namespace App\Entity;
use App\Repository\DirectionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Uid\Uuid;
/**
* @ORM\Entity(repositoryClass=DirectionRepository::class)
* @UniqueEntity(fields={"nom"}, message="Cette direction existe déjà")
*/
class Direction
{
/**
* @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=Cv::class, mappedBy="direction")
*/
private $cvs;
/**
* @ORM\OneToMany(targetEntity=Droit::class, mappedBy="direction")
*/
private $droits;
/**
* @ORM\OneToMany(targetEntity=Post::class, mappedBy="direction")
*/
private $posts;
/**
* @ORM\OneToMany(targetEntity=Agora::class, mappedBy="direction")
*/
private $agoras;
/**
* @ORM\OneToMany(targetEntity=Referent::class, mappedBy="direction")
*/
private $referents;
public function __construct()
{
$this->uuid = Uuid::v4();
$this->cvs = new ArrayCollection();
$this->droits = new ArrayCollection();
$this->posts = new ArrayCollection();
$this->agoras = new ArrayCollection();
$this->referents = 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, Cv>
*/
public function getCvs(): Collection
{
return $this->cvs;
}
public function addCv(Cv $cv): self
{
if (!$this->cvs->contains($cv)) {
$this->cvs[] = $cv;
$cv->setDirection($this);
}
return $this;
}
public function removeCv(Cv $cv): self
{
if ($this->cvs->removeElement($cv)) {
// set the owning side to null (unless already changed)
if ($cv->getDirection() === $this) {
$cv->setDirection(null);
}
}
return $this;
}
/**
* @return Collection<int, Droit>
*/
public function getDroits(): Collection
{
return $this->droits;
}
public function addDroit(Droit $droit): self
{
if (!$this->droits->contains($droit)) {
$this->droits[] = $droit;
$droit->setDirection($this);
}
return $this;
}
public function removeDroit(Droit $droit): self
{
if ($this->droits->removeElement($droit)) {
// set the owning side to null (unless already changed)
if ($droit->getDirection() === $this) {
$droit->setDirection(null);
}
}
return $this;
}
/**
* @return Collection<int, Post>
*/
public function getPosts(): Collection
{
return $this->posts;
}
public function addPost(Post $post): self
{
if (!$this->posts->contains($post)) {
$this->posts[] = $post;
$post->setDirection($this);
}
return $this;
}
public function removePost(Post $post): self
{
if ($this->posts->removeElement($post)) {
// set the owning side to null (unless already changed)
if ($post->getDirection() === $this) {
$post->setDirection(null);
}
}
return $this;
}
/**
* @return Collection<int, Agora>
*/
public function getAgoras(): Collection
{
return $this->agoras;
}
public function addAgora(Agora $agora): self
{
if (!$this->agoras->contains($agora)) {
$this->agoras[] = $agora;
$agora->setDirection($this);
}
return $this;
}
public function removeAgora(Agora $agora): self
{
if ($this->agoras->removeElement($agora)) {
// set the owning side to null (unless already changed)
if ($agora->getDirection() === $this) {
$agora->setDirection(null);
}
}
return $this;
}
/**
* @return Collection<int, Referent>
*/
public function getReferents(): Collection
{
return $this->referents;
}
public function addReferent(Referent $referent): self
{
if (!$this->referents->contains($referent)) {
$this->referents[] = $referent;
$referent->setDirection($this);
}
return $this;
}
public function removeReferent(Referent $referent): self
{
if ($this->referents->removeElement($referent)) {
// set the owning side to null (unless already changed)
if ($referent->getDirection() === $this) {
$referent->setDirection(null);
}
}
return $this;
}
}