src/Entity/EarningGroup.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EarningGroupRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Timestampable\Traits\TimestampableEntity;
  9. #[ORM\Entity(repositoryClassEarningGroupRepository::class)]
  10. class EarningGroup
  11. {
  12.     use TimestampableEntity;
  13.     
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $name null;
  20.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  21.     private ?string $description null;
  22.     #[ORM\OneToMany(mappedBy'earningGroup'targetEntityRuleResult::class)]
  23.     private Collection $ruleResults;
  24.     #[ORM\OneToMany(mappedBy'earningGroup'targetEntityCommission::class)]
  25.     private Collection $commissions;
  26.     #[ORM\Column]
  27.     private ?bool $incentiveStatement false;
  28.     #[ORM\OneToMany(mappedBy'earningGroup'targetEntityManualPayment::class)]
  29.     private Collection $manualPayments;
  30.     public function __construct()
  31.     {
  32.         $this->ruleResults = new ArrayCollection();
  33.         $this->commissions = new ArrayCollection();
  34.         $this->manualPayments = 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): static
  45.     {
  46.         $this->name $name;
  47.         return $this;
  48.     }
  49.     public function getDescription(): ?string
  50.     {
  51.         return $this->description;
  52.     }
  53.     public function setDescription(?string $description): static
  54.     {
  55.         $this->description $description;
  56.         return $this;
  57.     }
  58.     /**
  59.      * @return Collection<int, RuleResult>
  60.      */
  61.     public function getRuleResults(): Collection
  62.     {
  63.         return $this->ruleResults;
  64.     }
  65.     public function addRuleResult(RuleResult $ruleResult): static
  66.     {
  67.         if (!$this->ruleResults->contains($ruleResult)) {
  68.             $this->ruleResults->add($ruleResult);
  69.             $ruleResult->setEarningGroup($this);
  70.         }
  71.         return $this;
  72.     }
  73.     public function removeRuleResult(RuleResult $ruleResult): static
  74.     {
  75.         if ($this->ruleResults->removeElement($ruleResult)) {
  76.             // set the owning side to null (unless already changed)
  77.             if ($ruleResult->getEarningGroup() === $this) {
  78.                 $ruleResult->setEarningGroup(null);
  79.             }
  80.         }
  81.         return $this;
  82.     }
  83.     /**
  84.      * @return Collection<int, Commission>
  85.      */
  86.     public function getCommissions(): Collection
  87.     {
  88.         return $this->commissions;
  89.     }
  90.     public function addCommission(Commission $commission): static
  91.     {
  92.         if (!$this->commissions->contains($commission)) {
  93.             $this->commissions->add($commission);
  94.             $commission->setEarningGroup($this);
  95.         }
  96.         return $this;
  97.     }
  98.     public function removeCommission(Commission $commission): static
  99.     {
  100.         if ($this->commissions->removeElement($commission)) {
  101.             // set the owning side to null (unless already changed)
  102.             if ($commission->getEarningGroup() === $this) {
  103.                 $commission->setEarningGroup(null);
  104.             }
  105.         }
  106.         return $this;
  107.     }
  108.     public function isIncentiveStatement(): ?bool
  109.     {
  110.         return $this->incentiveStatement;
  111.     }
  112.     public function setIncentiveStatement(bool $incentiveStatement): static
  113.     {
  114.         $this->incentiveStatement $incentiveStatement;
  115.         return $this;
  116.     }
  117.     /**
  118.      * @return Collection<int, ManualPayment>
  119.      */
  120.     public function getManualPayments(): Collection
  121.     {
  122.         return $this->manualPayments;
  123.     }
  124.     public function addManualPayment(ManualPayment $manualPayment): static
  125.     {
  126.         if (!$this->manualPayments->contains($manualPayment)) {
  127.             $this->manualPayments->add($manualPayment);
  128.             $manualPayment->setEarningGroup($this);
  129.         }
  130.         return $this;
  131.     }
  132.     public function removeManualPayment(ManualPayment $manualPayment): static
  133.     {
  134.         if ($this->manualPayments->removeElement($manualPayment)) {
  135.             // set the owning side to null (unless already changed)
  136.             if ($manualPayment->getEarningGroup() === $this) {
  137.                 $manualPayment->setEarningGroup(null);
  138.             }
  139.         }
  140.         return $this;
  141.     }
  142.     public function __toString(): string
  143.     {
  144.         return $this->name;
  145.     }
  146. }