src/Entity/Categorie.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 App\Repository\CategorieRepository;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. /**
  10.  * @ORM\Entity(repositoryClass=CategorieRepository::class)
  11.  * @UniqueEntity(fields={"nom"}, message="Cette catégorie existe déjà")
  12.  */
  13. class Categorie
  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\Column(type="text", nullable=true)
  51.      */
  52.     private $description;
  53.     /**
  54.      * @ORM\Column(type="integer", nullable=true)
  55.      */
  56.     private $listorder;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      */
  60.     private $src;
  61.     /**
  62.      * @ORM\Column(type="text", nullable=true)
  63.      */
  64.     private $alt;
  65.     /**
  66.      * @ORM\Column(type="string", length=255, nullable=true)
  67.      */
  68.     private $title;
  69.     /**
  70.      * @ORM\Column(type="string", length=255, nullable=true)
  71.      */
  72.     private $srcImg;
  73.     /**
  74.      * @ORM\Column(type="text", nullable=true)
  75.      */
  76.     private $altImg;
  77.     /**
  78.      * @ORM\Column(type="string", length=255, nullable=true)
  79.      */
  80.     private $titleImg;
  81.     /**
  82.      * @ORM\Column(type="text", nullable=true)
  83.      */
  84.     private $intro;
  85.     /**
  86.      * @ORM\OneToMany(targetEntity=Agora::class, mappedBy="categorie")
  87.      */
  88.     private $agoras;
  89.     /**
  90.      * @ORM\Column(type="boolean", nullable=true)
  91.      */
  92.     private $entite;
  93.     public function __construct()
  94.     {
  95.         $this->uuid Uuid::v4();
  96.         $this->agoras = new ArrayCollection();
  97.     }
  98.     public function getId(): ?int
  99.     {
  100.         return $this->id;
  101.     }
  102.     public function getUuid(): ?string
  103.     {
  104.         return $this->uuid;
  105.     }
  106.     public function setUuid(?string $uuid): self
  107.     {
  108.         $this->uuid $uuid;
  109.         return $this;
  110.     }
  111.     public function getToken(): ?string
  112.     {
  113.         return $this->token;
  114.     }
  115.     public function setToken(?string $token): self
  116.     {
  117.         $this->token $token;
  118.         return $this;
  119.     }
  120.     public function getNom(): ?string
  121.     {
  122.         return $this->nom;
  123.     }
  124.     public function setNom(?string $nom): self
  125.     {
  126.         $this->nom $nom;
  127.         return $this;
  128.     }
  129.     public function getDescription(): ?string
  130.     {
  131.         return $this->description;
  132.     }
  133.     public function setDescription(?string $description): self
  134.     {
  135.         $this->description $description;
  136.         return $this;
  137.     }
  138.     public function getSlug(): ?string
  139.     {
  140.         return $this->slug;
  141.     }
  142.     public function setSlug(?string $slug): self
  143.     {
  144.         $this->slug $slug;
  145.         return $this;
  146.     }
  147.     public function getListorder(): ?int
  148.     {
  149.         return $this->listorder;
  150.     }
  151.     public function setListorder(?int $listorder): self
  152.     {
  153.         $this->listorder $listorder;
  154.         return $this;
  155.     }
  156.     public function isStatut(): ?bool
  157.     {
  158.         return $this->statut;
  159.     }
  160.     public function setStatut(?bool $statut): self
  161.     {
  162.         $this->statut $statut;
  163.         return $this;
  164.     }
  165.     
  166.     public function getCreatedAt(): ?\DateTimeImmutable
  167.     {
  168.         return $this->createdAt;
  169.     }
  170.     public function setCreatedAt(?\DateTimeImmutable $createdAt): self
  171.     {
  172.         $this->createdAt $createdAt;
  173.         return $this;
  174.     }
  175.     public function getUpdatedAt(): ?\DateTimeInterface
  176.     {
  177.         return $this->updatedAt;
  178.     }
  179.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  180.     {
  181.         $this->updatedAt $updatedAt;
  182.         return $this;
  183.     }
  184.     public function getSrc(): ?string
  185.     {
  186.         return $this->src;
  187.     }
  188.     public function setSrc(?string $src): self
  189.     {
  190.         $this->src $src;
  191.         return $this;
  192.     }
  193.     public function getAlt(): ?string
  194.     {
  195.         return $this->alt;
  196.     }
  197.     public function setAlt(?string $alt): self
  198.     {
  199.         $this->alt $alt;
  200.         return $this;
  201.     }
  202.     public function getTitle(): ?string
  203.     {
  204.         return $this->title;
  205.     }
  206.     public function setTitle(?string $title): self
  207.     {
  208.         $this->title $title;
  209.         return $this;
  210.     }
  211.     public function getSrcImg(): ?string
  212.     {
  213.         return $this->srcImg;
  214.     }
  215.     public function setSrcImg(?string $srcImg): self
  216.     {
  217.         $this->srcImg $srcImg;
  218.         return $this;
  219.     }
  220.     public function getAltImg(): ?string
  221.     {
  222.         return $this->altImg;
  223.     }
  224.     public function setAltImg(?string $altImg): self
  225.     {
  226.         $this->altImg $altImg;
  227.         return $this;
  228.     }
  229.     public function getTitleImg(): ?string
  230.     {
  231.         return $this->titleImg;
  232.     }
  233.     public function setTitleImg(?string $titleImg): self
  234.     {
  235.         $this->titleImg $titleImg;
  236.         return $this;
  237.     }
  238.     public function getIntro(): ?string
  239.     {
  240.         return $this->intro;
  241.     }
  242.     public function setIntro(?string $intro): self
  243.     {
  244.         $this->intro $intro;
  245.         return $this;
  246.     }
  247.     /**
  248.      * @return Collection<int, Agora>
  249.      */
  250.     public function getAgoras(): Collection
  251.     {
  252.         return $this->agoras;
  253.     }
  254.     public function addAgora(Agora $agora): self
  255.     {
  256.         if (!$this->agoras->contains($agora)) {
  257.             $this->agoras[] = $agora;
  258.             $agora->setCategorie($this);
  259.         }
  260.         return $this;
  261.     }
  262.     public function removeAgora(Agora $agora): self
  263.     {
  264.         if ($this->agoras->removeElement($agora)) {
  265.             // set the owning side to null (unless already changed)
  266.             if ($agora->getCategorie() === $this) {
  267.                 $agora->setCategorie(null);
  268.             }
  269.         }
  270.         return $this;
  271.     }
  272.     public function isEntite(): ?bool
  273.     {
  274.         return $this->entite;
  275.     }
  276.     public function setEntite(?bool $entite): self
  277.     {
  278.         $this->entite $entite;
  279.         return $this;
  280.     }
  281. }