src/Entity/Fournisseur.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FournisseurRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassFournisseurRepository::class)]
  8. class Fournisseur implements \Stringable
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255nullabletrue)]
  15.     private $name;
  16.     #[ORM\Column(type'boolean'nullabletrue)]
  17.     private $active;
  18.     #[ORM\Column(type'string'length255nullabletrue)]
  19.     private $code_fournisseur;
  20.     #[ORM\Column(type'boolean'nullabletrue)]
  21.     private $non_jde;
  22.     #[ORM\OneToMany(targetEntityUser::class, mappedBy'fournisseur')]
  23.     private $users;
  24.     public function __construct()
  25.     {
  26.         $this->users = new ArrayCollection();
  27.     }
  28.     public function getId(): ?int
  29.     {
  30.         return $this->id;
  31.     }
  32.     public function __toString(): string
  33.     {
  34.         return (string) $this->name;
  35.     }
  36.     public function getName(): ?string
  37.     {
  38.         return $this->name;
  39.     }
  40.     public function setName(?string $name): self
  41.     {
  42.         $this->name $name;
  43.         return $this;
  44.     }
  45.     public function getActive(): ?bool
  46.     {
  47.         return $this->active;
  48.     }
  49.     public function setActive(?bool $active): self
  50.     {
  51.         $this->active $active;
  52.         return $this;
  53.     }
  54.     public function getCodeFournisseur(): ?string
  55.     {
  56.         return $this->code_fournisseur;
  57.     }
  58.     public function setCodeFournisseur(?string $code_fournisseur): self
  59.     {
  60.         $this->code_fournisseur $code_fournisseur;
  61.         return $this;
  62.     }
  63.     public function getNonJde(): ?bool
  64.     {
  65.         return $this->non_jde;
  66.     }
  67.     public function setNonJde(?bool $non_jde): self
  68.     {
  69.         $this->non_jde $non_jde;
  70.         return $this;
  71.     }
  72.     /**
  73.      * @return Collection|User[]
  74.      */
  75.     public function getUsers(): Collection
  76.     {
  77.         return $this->users;
  78.     }
  79.     public function addUser(User $user): self
  80.     {
  81.         if (!$this->users->contains($user)) {
  82.             $this->users[] = $user;
  83.             $user->setFournisseur($this);
  84.         }
  85.         return $this;
  86.     }
  87.     public function removeUser(User $user): self
  88.     {
  89.         if ($this->users->removeElement($user)) {
  90.             // set the owning side to null (unless already changed)
  91.             if ($user->getFournisseur() === $this) {
  92.                 $user->setFournisseur(null);
  93.             }
  94.         }
  95.         return $this;
  96.     }
  97. }