src/Entity/Fonctions.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\FonctionsRepository")
  8.  */
  9. class Fonctions
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255, nullable=true)
  19.      */
  20.     private $name;
  21.     /**
  22.      * @ORM\Column(type="string", length=255, nullable=true)
  23.      */
  24.     private $type;
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity="App\Entity\Ref")
  27.      */
  28.     private $statut;
  29.     /**
  30.      * @ORM\OneToMany(targetEntity="App\Entity\User", mappedBy="idFonction")
  31.      */
  32.     private $users;
  33.     public function __construct()
  34.     {
  35.         $this->users = new ArrayCollection();
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getName(): ?string
  42.     {
  43.         return $this->name;
  44.     }
  45.     public function setName(?string $name): self
  46.     {
  47.         $this->name $name;
  48.         return $this;
  49.     }
  50.     public function getType(): ?string
  51.     {
  52.         return $this->type;
  53.     }
  54.     public function setType(?string $type): self
  55.     {
  56.         $this->type $type;
  57.         return $this;
  58.     }
  59.     public function getStatut(): ?Ref
  60.     {
  61.         return $this->statut;
  62.     }
  63.     public function setStatut(?Ref $statut): self
  64.     {
  65.         $this->statut $statut;
  66.         return $this;
  67.     }
  68.     /**
  69.      * @return Collection|User[]
  70.      */
  71.     public function getUsers(): Collection
  72.     {
  73.         return $this->users;
  74.     }
  75.     public function addUser(User $user): self
  76.     {
  77.         if (!$this->users->contains($user)) {
  78.             $this->users[] = $user;
  79.             $user->setIdFonction($this);
  80.         }
  81.         return $this;
  82.     }
  83.     public function removeUser(User $user): self
  84.     {
  85.         if ($this->users->contains($user)) {
  86.             $this->users->removeElement($user);
  87.             // set the owning side to null (unless already changed)
  88.             if ($user->getIdFonction() === $this) {
  89.                 $user->setIdFonction(null);
  90.             }
  91.         }
  92.         return $this;
  93.     }
  94. }