src/Entity/Tax.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\TaxRepository")
  9.  */
  10. class Tax
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      * @Groups("Tax")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="decimal", precision=5, scale=2)
  21.      * @Groups("Tax")
  22.      */
  23.     private $amountTax;
  24.    
  25.     
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=PackageCompagny::class, mappedBy="tax")
  28.      */
  29.     private $packageCompagnies;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=Refund::class, mappedBy="tva")
  32.      */
  33.     private $refunds;
  34.     public function __construct()
  35.     {
  36.         
  37.         $this->packageCompagnies = new ArrayCollection();
  38.         $this->refunds = new ArrayCollection();
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getAmountTax(): ?string
  45.     {
  46.         return $this->amountTax;
  47.     }
  48.     public function setAmountTax(string $amountTax): self
  49.     {
  50.         $this->amountTax $amountTax;
  51.         return $this;
  52.     }
  53.     
  54.     /**
  55.      * @return Collection|PackageCompagny[]
  56.      */
  57.     public function getPackageCompagnies(): Collection
  58.     {
  59.         return $this->packageCompagnies;
  60.     }
  61.     public function addPackageCompagny(PackageCompagny $packageCompagny): self
  62.     {
  63.         if (!$this->packageCompagnies->contains($packageCompagny)) {
  64.             $this->packageCompagnies[] = $packageCompagny;
  65.             $packageCompagny->setTax($this);
  66.         }
  67.         return $this;
  68.     }
  69.     public function removePackageCompagny(PackageCompagny $packageCompagny): self
  70.     {
  71.         if ($this->packageCompagnies->contains($packageCompagny)) {
  72.             $this->packageCompagnies->removeElement($packageCompagny);
  73.             // set the owning side to null (unless already changed)
  74.             if ($packageCompagny->getTax() === $this) {
  75.                 $packageCompagny->setTax(null);
  76.             }
  77.         }
  78.         return $this;
  79.     }
  80.     
  81.     public function __toString(){
  82.         return $this->amountTax;
  83.     }
  84.     /**
  85.      * @return Collection|Refund[]
  86.      */
  87.     public function getRefunds(): Collection
  88.     {
  89.         return $this->refunds;
  90.     }
  91.     public function addRefund(Refund $refund): self
  92.     {
  93.         if (!$this->refunds->contains($refund)) {
  94.             $this->refunds[] = $refund;
  95.             $refund->setTva($this);
  96.         }
  97.         return $this;
  98.     }
  99.     public function removeRefund(Refund $refund): self
  100.     {
  101.         if ($this->refunds->removeElement($refund)) {
  102.             // set the owning side to null (unless already changed)
  103.             if ($refund->getTva() === $this) {
  104.                 $refund->setTva(null);
  105.             }
  106.         }
  107.         return $this;
  108.     }
  109. }