src/Entity/Pays.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PaysRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassPaysRepository::class)]
  8. class Pays
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length10nullabletrue)]
  15.     private ?string $code_pays null;
  16.     #[ORM\Column(length255nullabletrue)]
  17.     private ?string $nom_pays null;
  18.     #[ORM\OneToMany(mappedBy'pays'targetEntityFilieres::class)]
  19.     private Collection $filieres;
  20.     public function __construct()
  21.     {
  22.         $this->filieres = new ArrayCollection();
  23.     }
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getCodePays(): ?string
  29.     {
  30.         return $this->code_pays;
  31.     }
  32.     public function setCodePays(?string $code_pays): self
  33.     {
  34.         $this->code_pays $code_pays;
  35.         return $this;
  36.     }
  37.     public function getNomPays(): ?string
  38.     {
  39.         return $this->nom_pays;
  40.     }
  41.     public function setNomPays(?string $nom_pays): self
  42.     {
  43.         $this->nom_pays $nom_pays;
  44.         return $this;
  45.     }
  46.     /**
  47.      * @return Collection<int, Filieres>
  48.      */
  49.     public function getFilieres(): Collection
  50.     {
  51.         return $this->filieres;
  52.     }
  53.     public function addFiliere(Filieres $filiere): self
  54.     {
  55.         if (!$this->filieres->contains($filiere)) {
  56.             $this->filieres->add($filiere);
  57.             $filiere->setIdPays($this);
  58.         }
  59.         return $this;
  60.     }
  61.     public function removeFiliere(Filieres $filiere): self
  62.     {
  63.         if ($this->filieres->removeElement($filiere)) {
  64.             // set the owning side to null (unless already changed)
  65.             if ($filiere->getIdPays() === $this) {
  66.                 $filiere->setIdPays(null);
  67.             }
  68.         }
  69.         return $this;
  70.     }
  71. }