src/Entity/CategoriePrix.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CategoriePrixRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=CategoriePrixRepository::class)
  9.  */
  10. class CategoriePrix
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=100)
  20.      */
  21.     private $nom;
  22.     /**
  23.      * @ORM\Column(type="decimal", precision=10, scale=2)
  24.      */
  25.     private $prix;
  26.     /**
  27.      * @ORM\Column(type="string", length=10, nullable=true)
  28.      */
  29.     private $devise = 'USD';
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity=Ville::class)
  32.      * @ORM\JoinColumn(nullable=true)
  33.      */
  34.     private $ville;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=TmpReception::class, mappedBy="categoriePrix")
  37.      */
  38.     private $tmpReceptions;
  39.     public function __construct()
  40.     {
  41.         $this->tmpReceptions = new ArrayCollection();
  42.     }
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getNom(): ?string
  48.     {
  49.         return $this->nom;
  50.     }
  51.     public function setNom(string $nom): self
  52.     {
  53.         $this->nom = $nom;
  54.         return $this;
  55.     }
  56.     public function getPrix(): ?string
  57.     {
  58.         return $this->prix;
  59.     }
  60.     public function setPrix(string $prix): self
  61.     {
  62.         $this->prix = $prix;
  63.         return $this;
  64.     }
  65.     public function getDevise(): ?string
  66.     {
  67.         return $this->devise;
  68.     }
  69.     public function setDevise(?string $devise): self
  70.     {
  71.         $this->devise = $devise;
  72.         return $this;
  73.     }
  74.     public function getVille(): ?Ville
  75.     {
  76.         return $this->ville;
  77.     }
  78.     public function setVille(?Ville $ville): self
  79.     {
  80.         $this->ville = $ville;
  81.         return $this;
  82.     }
  83.     /**
  84.      * @return Collection<int, TmpReception>
  85.      */
  86.     public function getTmpReceptions(): Collection
  87.     {
  88.         return $this->tmpReceptions;
  89.     }
  90.     public function addTmpReception(TmpReception $tmpReception): self
  91.     {
  92.         if (!$this->tmpReceptions->contains($tmpReception)) {
  93.             $this->tmpReceptions[] = $tmpReception;
  94.             $tmpReception->setCategoriePrix($this);
  95.         }
  96.         return $this;
  97.     }
  98.     public function removeTmpReception(TmpReception $tmpReception): self
  99.     {
  100.         if ($this->tmpReceptions->removeElement($tmpReception)) {
  101.             if ($tmpReception->getCategoriePrix() === $this) {
  102.                 $tmpReception->setCategoriePrix(null);
  103.             }
  104.         }
  105.         return $this;
  106.     }
  107.     public function __toString(): string
  108.     {
  109.         return sprintf('%s - %s %s', $this->nom, $this->prix, $this->devise);
  110.     }
  111. }