src/Entity/Profil.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProfilRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * Profil
  10.  *
  11.  * @ORM\Table(name="ref_profil")
  12.  * @ORM\Entity(repositoryClass=ProfilRepository::class)
  13.  * @Gedmo\Loggable
  14.  */
  15. class Profil
  16. {
  17.     /**
  18.      * @var int
  19.      *
  20.      * @ORM\Column(name="profil_id", type="integer", nullable=false)
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue(strategy="IDENTITY")
  23.      */
  24.     private $profilId;
  25.     /**
  26.      * @var string
  27.      *
  28.      * @ORM\Column(name="profil_lib", type="string", length=255, nullable=false)
  29.      * @Gedmo\Versioned
  30.      */
  31.     private $profilLib;
  32.     /**
  33.      * @var string
  34.      *
  35.      * @ORM\Column(name="profil_sf", type="string", length=255, nullable=false)
  36.      * @Gedmo\Versioned
  37.      */
  38.     private $profilSf;
  39.     /**
  40.      * @ORM\ManyToMany(targetEntity="User", mappedBy="profil")
  41.      */
  42.     private $user;
  43.     public function __construct()
  44.     {
  45.         $this->user = new ArrayCollection();
  46.     }
  47.     public function getProfilId(): ?int
  48.     {
  49.         return $this->profilId;
  50.     }
  51.     public function getProfilLib(): ?string
  52.     {
  53.         return $this->profilLib;
  54.     }
  55.     public function setProfilLib(string $profilLib): self
  56.     {
  57.         $this->profilLib $profilLib;
  58.         return $this;
  59.     }
  60.     public function getProfilSf(): ?string
  61.     {
  62.         return $this->profilSf;
  63.     }
  64.     public function setProfilSf(string $profilSf): self
  65.     {
  66.         $this->profilSf $profilSf;
  67.         return $this;
  68.     }
  69.     public function __toString()
  70.     {
  71.         return $this->profilSf;
  72.     }
  73.     /**
  74.      * @return Collection<int, User>
  75.      */
  76.     public function getUser(): Collection
  77.     {
  78.         return $this->user;
  79.     }
  80.     public function addUser(User $user): self
  81.     {
  82.         if (!$this->user->contains($user)) {
  83.             $this->user[] = $user;
  84.             $user->addProfil($this);
  85.         }
  86.         return $this;
  87.     }
  88.     public function removeUser(User $user): self
  89.     {
  90.         if ($this->user->removeElement($user)) {
  91.             $user->removeProfil($this);
  92.         }
  93.         return $this;
  94.     }
  95. }