src/Entity/Commune.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CommuneRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=CommuneRepository::class)
  9.  */
  10. class Commune
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $nom;
  22.     /**
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $taxe_sejour;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=Product::class, mappedBy="commune")
  28.      */
  29.     private $products;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      */
  33.     private $code;
  34.     public function __construct()
  35.     {
  36.         $this->products = new ArrayCollection();
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getNom(): ?string
  43.     {
  44.         return $this->nom;
  45.     }
  46.     public function setNom(string $nom): self
  47.     {
  48.         $this->nom $nom;
  49.         return $this;
  50.     }
  51.     public function getTaxeSejour(): ?int
  52.     {
  53.         return $this->taxe_sejour;
  54.     }
  55.     public function setTaxeSejour(int $taxe_sejour): self
  56.     {
  57.         $this->taxe_sejour $taxe_sejour;
  58.         return $this;
  59.     }
  60.     /**
  61.      * @return Collection<int, Product>
  62.      */
  63.     public function getProducts(): Collection
  64.     {
  65.         return $this->products;
  66.     }
  67.     public function addProduct(Product $product): self
  68.     {
  69.         if (!$this->products->contains($product)) {
  70.             $this->products[] = $product;
  71.             $product->setCommune($this);
  72.         }
  73.         return $this;
  74.     }
  75.     public function removeProduct(Product $product): self
  76.     {
  77.         if ($this->products->removeElement($product)) {
  78.             // set the owning side to null (unless already changed)
  79.             if ($product->getCommune() === $this) {
  80.                 $product->setCommune(null);
  81.             }
  82.         }
  83.         return $this;
  84.     }
  85.     public function getCode(): ?string
  86.     {
  87.         return $this->code;
  88.     }
  89.     public function setCode(string $code): self
  90.     {
  91.         $this->code $code;
  92.         return $this;
  93.     }
  94. }