src/Entity/UserPaymentPeriod.php line 14

  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\CustomerClass;
  4. use App\Enum\RegionEnum;
  5. use App\Repository\UserPaymentPeriodRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Timestampable\Traits\TimestampableEntity;
  10. #[ORM\Entity(repositoryClassUserPaymentPeriodRepository::class)]
  11. class UserPaymentPeriod
  12. {
  13.     use TimestampableEntity;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\ManyToOne(inversedBy'userPaymentPeriods'cascade: ['REMOVE'])]
  19.     #[ORM\JoinColumn(nullablefalse)]
  20.     private ?PaymentPeriod $paymentPeriod null;
  21.     #[ORM\ManyToOne(inversedBy'userPaymentPeriods')]
  22.     #[ORM\JoinColumn(nullablefalse)]
  23.     private ?User $user null;
  24.     #[ORM\OneToMany(mappedBy'userPaymentPeriod'targetEntityOrder::class, cascade: ['REMOVE'])]
  25.     private Collection $orders;
  26.     #[ORM\OneToMany(mappedBy'userPaymentPeriod'targetEntityCreditResult::class, cascade: ['REMOVE'])]
  27.     private Collection $creditResults;
  28.     #[ORM\OneToMany(mappedBy'userPaymentPeriod'targetEntityCommissionResult::class, cascade: ['REMOVE'])]
  29.     private Collection $commissionResults;
  30.     #[ORM\OneToMany(mappedBy'userPaymentPeriod'targetEntityAggregatedCommissions::class, cascade: ['REMOVE'])]
  31.     private Collection $aggregatedCommissions;
  32.     #[ORM\OneToMany(mappedBy'userPaymentPeriod'targetEntityTrueUp::class, cascade: ['REMOVE'])]
  33.     private Collection $trueUps;
  34.     #[ORM\OneToMany(mappedBy'userPaymentPeriod'targetEntityTotalDue::class, cascade: ['REMOVE'])]
  35.     private Collection $totalDues;
  36.     public function __construct()
  37.     {
  38.         $this->orders = new ArrayCollection();
  39.         $this->creditResults = new ArrayCollection();
  40.         $this->commissionResults = new ArrayCollection();
  41.         $this->aggregatedCommissions = new ArrayCollection();
  42.         $this->guaranteePayments = new ArrayCollection();
  43.         $this->trueUps = new ArrayCollection();
  44.         $this->totalDues = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getPaymentPeriod(): ?PaymentPeriod
  51.     {
  52.         return $this->paymentPeriod;
  53.     }
  54.     public function setPaymentPeriod(?PaymentPeriod $paymentPeriod): self
  55.     {
  56.         $this->paymentPeriod $paymentPeriod;
  57.         return $this;
  58.     }
  59.     public function getUser(): ?User
  60.     {
  61.         return $this->user;
  62.     }
  63.     public function setUser(?User $user): self
  64.     {
  65.         $this->user $user;
  66.         return $this;
  67.     }
  68.     /**
  69.      * @return Collection<int, Order>
  70.      */
  71.     public function getOrders(): Collection
  72.     {
  73.         return $this->orders;
  74.     }
  75.     public function addOrder(Order $order): self
  76.     {
  77.         if (!$this->orders->contains($order)) {
  78.             $this->orders->add($order);
  79.             $order->setUserPaymentPeriod($this);
  80.         }
  81.         return $this;
  82.     }
  83.     public function removeOrder(Order $order): self
  84.     {
  85.         if ($this->orders->removeElement($order)) {
  86.             // set the owning side to null (unless already changed)
  87.             if ($order->getUserPaymentPeriod() === $this) {
  88.                 $order->setUserPaymentPeriod(null);
  89.             }
  90.         }
  91.         return $this;
  92.     }
  93.     /**
  94.      * @return Collection<int, CreditResult>
  95.      */
  96.     public function getCreditResults(): Collection
  97.     {
  98.         return $this->creditResults;
  99.     }
  100.     public function addCreditResult(CreditResult $creditResult): self
  101.     {
  102.         if (!$this->creditResults->contains($creditResult)) {
  103.             $this->creditResults->add($creditResult);
  104.             $creditResult->setUserPaymentPeriod($this);
  105.         }
  106.         return $this;
  107.     }
  108.     public function removeCreditResult(CreditResult $creditResult): self
  109.     {
  110.         if ($this->creditResults->removeElement($creditResult)) {
  111.             // set the owning side to null (unless already changed)
  112.             if ($creditResult->getUserPaymentPeriod() === $this) {
  113.                 $creditResult->setUserPaymentPeriod(null);
  114.             }
  115.         }
  116.         return $this;
  117.     }
  118.     /**
  119.      * @return Collection<int, CommissionResult>
  120.      */
  121.     public function getCommissionResults(): Collection
  122.     {
  123.         return $this->commissionResults;
  124.     }
  125.     public function addCommissionResult(CommissionResult $commissionResult): self
  126.     {
  127.         if (!$this->commissionResults->contains($commissionResult)) {
  128.             $this->commissionResults->add($commissionResult);
  129.             $commissionResult->setUserPaymentPeriod($this);
  130.         }
  131.         return $this;
  132.     }
  133.     public function removeCommissionResult(CommissionResult $commissionResult): self
  134.     {
  135.         if ($this->commissionResults->removeElement($commissionResult)) {
  136.             // set the owning side to null (unless already changed)
  137.             if ($commissionResult->getUserPaymentPeriod() === $this) {
  138.                 $commissionResult->setUserPaymentPeriod(null);
  139.             }
  140.         }
  141.         return $this;
  142.     }
  143.     /**
  144.      * @return Collection<int, AggregatedCommissions>
  145.      */
  146.     public function getAggregatedCommissions(): Collection
  147.     {
  148.         return $this->aggregatedCommissions;
  149.     }
  150.     public function addAggregatedCommission(AggregatedCommissions $aggregatedCommission): self
  151.     {
  152.         if (!$this->aggregatedCommissions->contains($aggregatedCommission)) {
  153.             $this->aggregatedCommissions->add($aggregatedCommission);
  154.             $aggregatedCommission->setUserPaymentPeriod($this);
  155.         }
  156.         return $this;
  157.     }
  158.     public function removeAggregatedCommission(AggregatedCommissions $aggregatedCommission): self
  159.     {
  160.         if ($this->aggregatedCommissions->removeElement($aggregatedCommission)) {
  161.             // set the owning side to null (unless already changed)
  162.             if ($aggregatedCommission->getUserPaymentPeriod() === $this) {
  163.                 $aggregatedCommission->setUserPaymentPeriod(null);
  164.             }
  165.         }
  166.         return $this;
  167.     }
  168.     /**
  169.      * @return Collection<int, TrueUp>
  170.      */
  171.     public function getTrueUps(): Collection
  172.     {
  173.         return $this->trueUps;
  174.     }
  175.     public function addTrueUp(TrueUp $trueUp): self
  176.     {
  177.         if (!$this->trueUps->contains($trueUp)) {
  178.             $this->trueUps->add($trueUp);
  179.             $trueUp->setUserPaymentPeriod($this);
  180.         }
  181.         return $this;
  182.     }
  183.     public function removeTrueUp(TrueUp $trueUp): self
  184.     {
  185.         if ($this->trueUps->removeElement($trueUp)) {
  186.             // set the owning side to null (unless already changed)
  187.             if ($trueUp->getUserPaymentPeriod() === $this) {
  188.                 $trueUp->setUserPaymentPeriod(null);
  189.             }
  190.         }
  191.         return $this;
  192.     }
  193.     /**
  194.      * @return Collection<int, TotalDue>
  195.      */
  196.     public function getTotalDues(): Collection
  197.     {
  198.         return $this->totalDues;
  199.     }
  200.     public function addTotalDue(TotalDue $totalDue): self
  201.     {
  202.         if (!$this->totalDues->contains($totalDue)) {
  203.             $this->totalDues->add($totalDue);
  204.             $totalDue->setUserPaymentPeriod($this);
  205.         }
  206.         return $this;
  207.     }
  208.     public function removeTotalDue(TotalDue $totalDue): self
  209.     {
  210.         if ($this->totalDues->removeElement($totalDue)) {
  211.             // set the owning side to null (unless already changed)
  212.             if ($totalDue->getUserPaymentPeriod() === $this) {
  213.                 $totalDue->setUserPaymentPeriod(null);
  214.             }
  215.         }
  216.         return $this;
  217.     }
  218.     public function __toString()
  219.     {
  220.         return $this->user ' ' $this->paymentPeriod;
  221.     }
  222. }