<?php
namespace App\Entity;
use App\Repository\CategoriePrixRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CategoriePrixRepository::class)
*/
class CategoriePrix
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $nom;
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
*/
private $prix;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $devise = 'USD';
/**
* @ORM\ManyToOne(targetEntity=Ville::class)
* @ORM\JoinColumn(nullable=true)
*/
private $ville;
/**
* @ORM\OneToMany(targetEntity=TmpReception::class, mappedBy="categoriePrix")
*/
private $tmpReceptions;
public function __construct()
{
$this->tmpReceptions = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getPrix(): ?string
{
return $this->prix;
}
public function setPrix(string $prix): self
{
$this->prix = $prix;
return $this;
}
public function getDevise(): ?string
{
return $this->devise;
}
public function setDevise(?string $devise): self
{
$this->devise = $devise;
return $this;
}
public function getVille(): ?Ville
{
return $this->ville;
}
public function setVille(?Ville $ville): self
{
$this->ville = $ville;
return $this;
}
/**
* @return Collection<int, TmpReception>
*/
public function getTmpReceptions(): Collection
{
return $this->tmpReceptions;
}
public function addTmpReception(TmpReception $tmpReception): self
{
if (!$this->tmpReceptions->contains($tmpReception)) {
$this->tmpReceptions[] = $tmpReception;
$tmpReception->setCategoriePrix($this);
}
return $this;
}
public function removeTmpReception(TmpReception $tmpReception): self
{
if ($this->tmpReceptions->removeElement($tmpReception)) {
if ($tmpReception->getCategoriePrix() === $this) {
$tmpReception->setCategoriePrix(null);
}
}
return $this;
}
public function __toString(): string
{
return sprintf('%s - %s %s', $this->nom, $this->prix, $this->devise);
}
}