src/Entity/Routes.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RoutesRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. /**
  8.  * @ORM\Entity(repositoryClass=RoutesRepository::class)
  9.  * @ORM\Table(name="rn_routes")
  10.  */
  11. class Routes
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $nom;
  23.     /**
  24.      * @ORM\OneToMany(targetEntity=Fichiers::class, mappedBy="routes",cascade={"persist"}, orphanRemoval=true)
  25.      */
  26.     private $fichiers;
  27.     /**
  28.      * @ORM\OneToMany(targetEntity=Emprunts::class, mappedBy="routes", orphanRemoval=true)
  29.      */
  30.     private $emprunts;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=PointEaux::class, mappedBy="routes", orphanRemoval=true)
  33.      */
  34.     private $pointEaux;
  35.     public function __construct()
  36.     {
  37.         $this->fichiers = new ArrayCollection();
  38.         $this->emprunts = new ArrayCollection();
  39.         $this->pointEaux = new ArrayCollection();
  40.     }
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function getNom(): ?string
  46.     {
  47.         return $this->nom;
  48.     }
  49.     public function setNom(string $nom): self
  50.     {
  51.         $this->nom $nom;
  52.         return $this;
  53.     }
  54.     /**
  55.      * @return Collection|Fichiers[]
  56.      */
  57.     public function getFichiers(): Collection
  58.     {
  59.         return $this->fichiers;
  60.     }
  61.     public function addFichier(Fichiers $fichier): self
  62.     {
  63.         if (!$this->fichiers->contains($fichier)) {
  64.             $this->fichiers[] = $fichier;
  65.             $fichier->setRoutes($this);
  66.         }
  67.         return $this;
  68.     }
  69.     public function removeFichier(Fichiers $fichier): self
  70.     {
  71.         if ($this->fichiers->contains($fichier)) {
  72.             $this->fichiers->removeElement($fichier);
  73.             // set the owning side to null (unless already changed)
  74.             if ($fichier->getRoutes() === $this) {
  75.                 $fichier->setRoutes(null);
  76.             }
  77.         }
  78.         return $this;
  79.     }
  80.     /**
  81.      * @return Collection|Emprunts[]
  82.      */
  83.     public function getEmprunts(): Collection
  84.     {
  85.         return $this->emprunts;
  86.     }
  87.     public function addEmprunt(Emprunts $emprunt): self
  88.     {
  89.         if (!$this->emprunts->contains($emprunt)) {
  90.             $this->emprunts[] = $emprunt;
  91.             $emprunt->setRoutes($this);
  92.         }
  93.         return $this;
  94.     }
  95.     public function removeEmprunt(Emprunts $emprunt): self
  96.     {
  97.         if ($this->emprunts->removeElement($emprunt)) {
  98.             // set the owning side to null (unless already changed)
  99.             if ($emprunt->getRoutes() === $this) {
  100.                 $emprunt->setRoutes(null);
  101.             }
  102.         }
  103.         return $this;
  104.     }
  105.     /**
  106.      * @return Collection|PointEaux[]
  107.      */
  108.     public function getPointEaux(): Collection
  109.     {
  110.         return $this->pointEaux;
  111.     }
  112.     public function addPointEaux(PointEaux $pointEaux): self
  113.     {
  114.         if (!$this->pointEaux->contains($pointEaux)) {
  115.             $this->pointEaux[] = $pointEaux;
  116.             $pointEaux->setRoutes($this);
  117.         }
  118.         return $this;
  119.     }
  120.     public function removePointEaux(PointEaux $pointEaux): self
  121.     {
  122.         if ($this->pointEaux->removeElement($pointEaux)) {
  123.             // set the owning side to null (unless already changed)
  124.             if ($pointEaux->getRoutes() === $this) {
  125.                 $pointEaux->setRoutes(null);
  126.             }
  127.         }
  128.         return $this;
  129.     }
  130.     
  131.     public function __toString() {
  132.         return $this->nom;
  133.     }
  134. }