<?php
namespace App\Entity;
use App\Repository\ZoneRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ZoneRepository::class)
*/
class Zone
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $nom;
/**
* @ORM\Column(type="float", nullable="true")
*/
private $caisseBoisMontantBouteilleSix;
/**
* @ORM\Column(type="float", nullable="true")
*/
private $caisseBoisMontantBouteillesDouze;
/**
* @ORM\OneToMany(targetEntity=Pays::class, mappedBy="zone")
*/
private $pays;
/**
* @ORM\OneToMany(targetEntity=TypeTarifs::class, mappedBy="zone")
*/
private $typeTarifs;
/**
* @ORM\OneToMany(targetEntity=QuantiteBouteille::class, mappedBy="zone")
* @ORM\OrderBy({"ordre" = "ASC"})
*/
private $quantitesBouteilles;
/**
* @ORM\OneToMany(targetEntity=Frais::class, mappedBy="zone")
*/
private $frais;
/**
* @ORM\ManyToOne(targetEntity=Annee::class, inversedBy="zones")
*/
private $annee;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isUsa;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $assujettiTva;
/**
* @ORM\OneToMany(targetEntity=Information::class, mappedBy="zone", orphanRemoval=true)
* @ORM\OrderBy({"ordre" = "ASC"})
*/
private $information;
public function __construct()
{
$this->pays = new ArrayCollection();
$this->typeTarifs = new ArrayCollection();
$this->quantitesBouteilles = new ArrayCollection();
$this->frais = new ArrayCollection();
$this->information = 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 getCaisseBoisMontantBouteilleSix(): ?float
{
return $this->caisseBoisMontantBouteilleSix;
}
public function setCaisseBoisMontantBouteilleSix(float $caisseBoisMontantBouteilleSix): self
{
$this->caisseBoisMontantBouteilleSix = $caisseBoisMontantBouteilleSix;
return $this;
}
public function getCaisseBoisMontantBouteillesDouze(): ?float
{
return $this->caisseBoisMontantBouteillesDouze;
}
public function setCaisseBoisMontantBouteillesDouze(float $caisseBoisMontantBouteillesDouze): self
{
$this->caisseBoisMontantBouteillesDouze = $caisseBoisMontantBouteillesDouze;
return $this;
}
/**
* @return Collection<int, Pays>
*/
public function getPays(): Collection
{
// Permet de retourner par ordre alphabétique
$paysArray = $this->pays->toArray();
usort($paysArray, function($a, $b) {
return strcmp($a->getNom(), $b->getNom());
});
return new ArrayCollection($paysArray);
}
public function addPay(Pays $pay): self
{
if (!$this->pays->contains($pay)) {
$this->pays[] = $pay;
$pay->setZone($this);
}
return $this;
}
public function removePay(Pays $pay): self
{
if ($this->pays->removeElement($pay)) {
// set the owning side to null (unless already changed)
if ($pay->getZone() === $this) {
$pay->setZone(null);
}
}
return $this;
}
/**
* @return Collection<int, TypeTarifs>
*/
public function getTypeTarifs(): Collection
{
return $this->typeTarifs;
}
public function addTypeTarif(TypeTarifs $typeTarif): self
{
if (!$this->typeTarifs->contains($typeTarif)) {
$this->typeTarifs[] = $typeTarif;
$typeTarif->setZone($this);
}
return $this;
}
public function removeTypeTarif(TypeTarifs $typeTarif): self
{
if ($this->typeTarifs->removeElement($typeTarif)) {
// set the owning side to null (unless already changed)
if ($typeTarif->getZone() === $this) {
$typeTarif->setZone(null);
}
}
return $this;
}
/**
* @return Collection<int, QuantiteBouteille>
*/
public function getQuantitesBouteilles(): Collection
{
return $this->quantitesBouteilles;
}
public function addQuantitesBouteille(QuantiteBouteille $quantitesBouteille): self
{
if (!$this->quantitesBouteilles->contains($quantitesBouteille)) {
$this->quantitesBouteilles[] = $quantitesBouteille;
$quantitesBouteille->setZone($this);
}
return $this;
}
public function removeQuantitesBouteille(QuantiteBouteille $quantitesBouteille): self
{
if ($this->quantitesBouteilles->removeElement($quantitesBouteille)) {
// set the owning side to null (unless already changed)
if ($quantitesBouteille->getZone() === $this) {
$quantitesBouteille->setZone(null);
}
}
return $this;
}
/**
* @return Collection<int, Frais>
*/
public function getFrais(): Collection
{
return $this->frais;
}
public function addFrai(Frais $frai): self
{
if (!$this->frais->contains($frai)) {
$this->frais[] = $frai;
$frai->setZone($this);
}
return $this;
}
public function removeFrai(Frais $frai): self
{
if ($this->frais->removeElement($frai)) {
// set the owning side to null (unless already changed)
if ($frai->getZone() === $this) {
$frai->setZone(null);
}
}
return $this;
}
public function getAnnee(): ?Annee
{
return $this->annee;
}
public function setAnnee(?Annee $annee): self
{
$this->annee = $annee;
return $this;
}
public function isIsUsa(): ?bool
{
return $this->isUsa;
}
public function setIsUsa(?bool $isUsa): self
{
$this->isUsa = $isUsa;
return $this;
}
public function isAssujettiTva(): ?bool
{
return $this->assujettiTva;
}
public function setAssujettiTva(?bool $assujettiTva): self
{
$this->assujettiTva = $assujettiTva;
return $this;
}
/**
* @return Collection<int, Information>
*/
public function getInformation(): Collection
{
return $this->information;
}
public function addInformation(Information $information): self
{
if (!$this->information->contains($information)) {
$this->information[] = $information;
$information->setZone($this);
}
return $this;
}
public function removeInformation(Information $information): self
{
if ($this->information->removeElement($information)) {
// set the owning side to null (unless already changed)
if ($information->getZone() === $this) {
$information->setZone(null);
}
}
return $this;
}
}