<?php
namespace App\Entity;
use App\Repository\TvaRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=TvaRepository::class)
*/
class Tva
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=50)
*/
private $tva;
/**
* @ORM\OneToMany(targetEntity=Product::class, mappedBy="tva")
*/
private $products;
/**
* @ORM\Column(type="float")
*/
private $valeur;
public function __construct()
{
$this->products = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTva(): ?string
{
return $this->tva;
}
public function setTva(string $tva): self
{
$this->tva = $tva;
return $this;
}
/**
* @return Collection|Product[]
*/
public function getProducts(): Collection
{
return $this->products;
}
public function addProduct(Product $product): self
{
if (!$this->products->contains($product)) {
$this->products[] = $product;
$product->setTva($this);
}
return $this;
}
public function removeProduct(Product $product): self
{
if ($this->products->removeElement($product)) {
// set the owning side to null (unless already changed)
if ($product->getTva() === $this) {
$product->setTva(null);
}
}
return $this;
}
public function __toString()
{
return $this->getTva();
}
public function getValeur(): ?float
{
return $this->valeur;
}
public function setValeur(float $valeur): self
{
$this->valeur = $valeur;
return $this;
}
}