src/Entity/RateTableTier.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RateTableTierRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Timestampable\Traits\TimestampableEntity;
  8. #[ORM\Entity(repositoryClassRateTableTierRepository::class)]
  9. class RateTableTier
  10. {
  11.     use TimestampableEntity;
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255nullabletrue)]
  17.     private ?string $name null;
  18.     #[ORM\Column(nullabletrue)]
  19.     private ?int $low 0;
  20.     #[ORM\Column(nullabletrue)]
  21.     private ?int $high null;
  22.     #[ORM\Column]
  23.     private ?float $rate null;
  24.     #[ORM\ManyToOne(inversedBy'rateTableTiers')]
  25.     private ?Year $year null;
  26.     #[ORM\Column]
  27.     private ?int $tierNumber 1;
  28.     #[ORM\OneToMany(mappedBy'rateTableTier'targetEntityCommission::class)]
  29.     private Collection $commissions;
  30.     #[ORM\ManyToOne(inversedBy'rateTableTiers')]
  31.     private ?RateTableAssignment $rateTableAssignment null;
  32.     public function __construct()
  33.     {
  34.         $this->commissions = new ArrayCollection();
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getName(): ?string
  41.     {
  42.         return $this->name;
  43.     }
  44.     public function setName(string $name): self
  45.     {
  46.         $this->name $name;
  47.         return $this;
  48.     }
  49.     public function getLow(): ?int
  50.     {
  51.         return $this->low;
  52.     }
  53.     public function setLow(int $low): self
  54.     {
  55.         $this->low $low;
  56.         return $this;
  57.     }
  58.     public function getHigh(): ?int
  59.     {
  60.         return $this->high;
  61.     }
  62.     public function setHigh(?int $high): self
  63.     {
  64.         $this->high $high;
  65.         return $this;
  66.     }
  67.     public function getRate(): ?float
  68.     {
  69.         return $this->rate;
  70.     }
  71.     public function setRate(float $rate): self
  72.     {
  73.         $this->rate $rate;
  74.         return $this;
  75.     }
  76.     public function getYear(): ?Year
  77.     {
  78.         return $this->year;
  79.     }
  80.     public function setYear(?Year $year): self
  81.     {
  82.         $this->year $year;
  83.         return $this;
  84.     }
  85.     public function getTierNumber(): ?int
  86.     {
  87.         return $this->tierNumber;
  88.     }
  89.     public function setTierNumber(int $tierNumber): self
  90.     {
  91.         $this->tierNumber $tierNumber;
  92.         return $this;
  93.     }
  94.     /**
  95.      * @return Collection<int, Commission>
  96.      */
  97.     public function getCommissions(): Collection
  98.     {
  99.         return $this->commissions;
  100.     }
  101.     public function addCommission(Commission $commission): static
  102.     {
  103.         if (!$this->commissions->contains($commission)) {
  104.             $this->commissions->add($commission);
  105.             $commission->setRateTableTier($this);
  106.         }
  107.         return $this;
  108.     }
  109.     public function removeCommission(Commission $commission): static
  110.     {
  111.         if ($this->commissions->removeElement($commission)) {
  112.             // set the owning side to null (unless already changed)
  113.             if ($commission->getRateTableTier() === $this) {
  114.                 $commission->setRateTableTier(null);
  115.             }
  116.         }
  117.         return $this;
  118.     }
  119.     public function getDisplayName(): ?string
  120.     {
  121.         return sprintf('Tier-%s'$this->tierNumber);
  122.     }
  123.     public function __toString(): string
  124.     {
  125.         return $this->getDisplayName();
  126.     }
  127.     public function getRateTableAssignment(): ?RateTableAssignment
  128.     {
  129.         return $this->rateTableAssignment;
  130.     }
  131.     public function setRateTableAssignment(?RateTableAssignment $rateTableAssignment): static
  132.     {
  133.         $this->rateTableAssignment $rateTableAssignment;
  134.         return $this;
  135.     }
  136. }