src/Entity/Categorie.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CategorieRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassCategorieRepository::class)]
  8. class Categorie
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $titre null;
  16.     #[ORM\ManyToMany(targetEntityProjet::class, mappedBy'tag'cascade: ['persist'])]
  17.     private Collection $tags;
  18.     #[ORM\Column(length2550)]
  19.     private ?string $description null;
  20.     public function __construct()
  21.     {
  22.         $this->tags = new ArrayCollection();
  23.     }
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getTitre(): ?string
  29.     {
  30.         return $this->titre;
  31.     }
  32.     public function setTitre(string $titre): self
  33.     {
  34.         $this->titre $titre;
  35.         return $this;
  36.     }
  37.     /**
  38.      * @return Collection<int, Projet>
  39.      */
  40.     public function getTags(): Collection
  41.     {
  42.         return $this->tags;
  43.     }
  44.     public function addTag(Projet $tag): self
  45.     {
  46.         if (!$this->tags->contains($tag)) {
  47.             $this->tags->add($tag);
  48.         }
  49.         return $this;
  50.     }
  51.     public function removeTag(Projet $tag): self
  52.     {
  53.         $this->tags->removeElement($tag);
  54.         return $this;
  55.     }
  56.     public function __toString()
  57.     {
  58.         return $this->titre;
  59.     }
  60.     public function getDescription(): ?string
  61.     {
  62.         return $this->description;
  63.     }
  64.     public function setDescription(string $description): self
  65.     {
  66.         $this->description $description;
  67.         return $this;
  68.     }
  69. }