src/Entity/Classification.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Symfony\Component\Uid\Uuid;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\Collection;
  6. use App\Repository\ClassificationRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. /**
  10.  * @ORM\Entity(repositoryClass=ClassificationRepository::class)
  11.  * @UniqueEntity(fields={"nom"}, message="Cette classification existe déjà")
  12.  */
  13. class Classification
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255, nullable=true)
  23.      */
  24.     private $uuid;
  25.     /**
  26.      * @ORM\Column(type="string", length=255, nullable=true)
  27.      */
  28.     private $token;
  29.     /**
  30.      * @ORM\Column(type="string", length=255, nullable=true)
  31.      */
  32.     private $slug;
  33.     /**
  34.      * @ORM\Column(type="boolean", nullable=true)
  35.      */
  36.     private $statut false;
  37.     /**
  38.      * @ORM\Column(type="datetime_immutable", nullable=true)
  39.      */
  40.     private $createdAt;
  41.     /**
  42.      * @ORM\Column(type="datetime", nullable=true)
  43.      */
  44.     private $updatedAt;
  45.     /**
  46.      * @ORM\Column(type="string", length=255, nullable=true)
  47.      */
  48.     private $nom;
  49.     /**
  50.      * @ORM\OneToMany(targetEntity=Actualite::class, mappedBy="classification")
  51.      */
  52.     private $actualites;
  53.     public function __construct()
  54.     {
  55.         $this->uuid Uuid::v4();
  56.         $this->actualites = new ArrayCollection();
  57.     }
  58.     public function getId(): ?int
  59.     {
  60.         return $this->id;
  61.     }
  62.     public function getUuid(): ?string
  63.     {
  64.         return $this->uuid;
  65.     }
  66.     public function setUuid(?string $uuid): self
  67.     {
  68.         $this->uuid $uuid;
  69.         return $this;
  70.     }
  71.     public function getToken(): ?string
  72.     {
  73.         return $this->token;
  74.     }
  75.     public function setToken(?string $token): self
  76.     {
  77.         $this->token $token;
  78.         return $this;
  79.     }
  80.     public function getSlug(): ?string
  81.     {
  82.         return $this->slug;
  83.     }
  84.     public function setSlug(?string $slug): self
  85.     {
  86.         $this->slug $slug;
  87.         return $this;
  88.     }
  89.     public function isStatut(): ?bool
  90.     {
  91.         return $this->statut;
  92.     }
  93.     public function setStatut(?bool $statut): self
  94.     {
  95.         $this->statut $statut;
  96.         return $this;
  97.     }
  98.     public function getCreatedAt(): ?\DateTimeImmutable
  99.     {
  100.         return $this->createdAt;
  101.     }
  102.     public function setCreatedAt(?\DateTimeImmutable $createdAt): self
  103.     {
  104.         $this->createdAt $createdAt;
  105.         return $this;
  106.     }
  107.     public function getUpdatedAt(): ?\DateTimeInterface
  108.     {
  109.         return $this->updatedAt;
  110.     }
  111.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  112.     {
  113.         $this->updatedAt $updatedAt;
  114.         return $this;
  115.     }
  116.     public function getNom(): ?string
  117.     {
  118.         return $this->nom;
  119.     }
  120.     public function setNom(?string $nom): self
  121.     {
  122.         $this->nom $nom;
  123.         return $this;
  124.     }
  125.     /**
  126.      * @return Collection<int, Actualite>
  127.      */
  128.     public function getActualites(): Collection
  129.     {
  130.         return $this->actualites;
  131.     }
  132.     public function addActualite(Actualite $actualite): self
  133.     {
  134.         if (!$this->actualites->contains($actualite)) {
  135.             $this->actualites[] = $actualite;
  136.             $actualite->setClassification($this);
  137.         }
  138.         return $this;
  139.     }
  140.     public function removeActualite(Actualite $actualite): self
  141.     {
  142.         if ($this->actualites->removeElement($actualite)) {
  143.             // set the owning side to null (unless already changed)
  144.             if ($actualite->getClassification() === $this) {
  145.                 $actualite->setClassification(null);
  146.             }
  147.         }
  148.         return $this;
  149.     }
  150. }