src/Entity/CategorieAffaire.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CategorieAffaireRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassCategorieAffaireRepository::class)]
  8. class CategorieAffaire
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255nullabletrue)]
  15.     private $libelleCourt;
  16.     #[ORM\Column(type'string'length255nullabletrue)]
  17.     private $libelleLong;
  18.     #[ORM\Column(type'text'nullabletrue)]
  19.     private $remarques;
  20.     #[ORM\OneToMany(targetEntityAffaire::class, mappedBy'categorie'cascade: ['persist''detach'])]
  21.     private $affaires;
  22.     public function __construct()
  23.     {
  24.         $this->affaires = new ArrayCollection();
  25.     }
  26.     public function __toString()
  27.     {
  28.         return $this->getLibelleCourt();
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getLibelleCourt(): ?string
  35.     {
  36.         return $this->libelleCourt;
  37.     }
  38.     public function setLibelleCourt(?string $libelleCourt): self
  39.     {
  40.         $this->libelleCourt $libelleCourt;
  41.         return $this;
  42.     }
  43.     public function getLibelleLong(): ?string
  44.     {
  45.         return $this->libelleLong;
  46.     }
  47.     public function setLibelleLong(?string $libelleLong): self
  48.     {
  49.         $this->libelleLong $libelleLong;
  50.         return $this;
  51.     }
  52.     public function getRemarques(): ?string
  53.     {
  54.         return $this->remarques;
  55.     }
  56.     public function setRemarques(?string $remarques): self
  57.     {
  58.         $this->remarques $remarques;
  59.         return $this;
  60.     }
  61.     /**
  62.      * @return Collection|Affaire[]
  63.      */
  64.     public function getAffaires(): Collection
  65.     {
  66.         return $this->affaires;
  67.     }
  68.     public function addAffaire(Affaire $affaire): self
  69.     {
  70.         if (!$this->affaires->contains($affaire)) {
  71.             $this->affaires[] = $affaire;
  72.             $affaire->setCategorie($this);
  73.         }
  74.         return $this;
  75.     }
  76.     public function removeAffaire(Affaire $affaire): self
  77.     {
  78.         if ($this->affaires->removeElement($affaire)) {
  79.             // set the owning side to null (unless already changed)
  80.             if ($affaire->getCategorie() === $this) {
  81.                 $affaire->setCategorie(null);
  82.             }
  83.         }
  84.         return $this;
  85.     }
  86. }