src/Entity/ReasonCode.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ReasonCodeRepository;
  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(repositoryClassReasonCodeRepository::class)]
  10. class ReasonCode
  11. {
  12.     use TimestampableEntity;
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $name null;
  19.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  20.     private ?string $description null;
  21.     #[ORM\OneToMany(mappedBy'reasonCode'targetEntityRuleResult::class)]
  22.     private Collection $ruleResults;
  23.     #[ORM\OneToMany(mappedBy'reasonCode'targetEntityCredit::class)]
  24.     private Collection $credits;
  25.     #[ORM\OneToMany(mappedBy'reasonCode'targetEntityManualPayment::class)]
  26.     private Collection $manualPayments;
  27.     public function __construct()
  28.     {
  29.         $this->ruleResults = new ArrayCollection();
  30.         $this->credits = new ArrayCollection();
  31.         $this->manualPayments = new ArrayCollection();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getName(): ?string
  38.     {
  39.         return $this->name;
  40.     }
  41.     public function setName(string $name): static
  42.     {
  43.         $this->name $name;
  44.         return $this;
  45.     }
  46.     public function getDescription(): ?string
  47.     {
  48.         return $this->description;
  49.     }
  50.     public function setDescription(?string $description): static
  51.     {
  52.         $this->description $description;
  53.         return $this;
  54.     }
  55.     /**
  56.      * @return Collection<int, RuleResult>
  57.      */
  58.     public function getRuleResults(): Collection
  59.     {
  60.         return $this->ruleResults;
  61.     }
  62.     public function addRuleResult(RuleResult $ruleResult): static
  63.     {
  64.         if (!$this->ruleResults->contains($ruleResult)) {
  65.             $this->ruleResults->add($ruleResult);
  66.             $ruleResult->setReasonCode($this);
  67.         }
  68.         return $this;
  69.     }
  70.     public function removeRuleResult(RuleResult $ruleResult): static
  71.     {
  72.         if ($this->ruleResults->removeElement($ruleResult)) {
  73.             // set the owning side to null (unless already changed)
  74.             if ($ruleResult->getReasonCode() === $this) {
  75.                 $ruleResult->setReasonCode(null);
  76.             }
  77.         }
  78.         return $this;
  79.     }
  80.     /**
  81.      * @return Collection<int, Credit>
  82.      */
  83.     public function getCredits(): Collection
  84.     {
  85.         return $this->credits;
  86.     }
  87.     public function addCredit(Credit $credit): static
  88.     {
  89.         if (!$this->credits->contains($credit)) {
  90.             $this->credits->add($credit);
  91.             $credit->setReasonCode($this);
  92.         }
  93.         return $this;
  94.     }
  95.     public function removeCredit(Credit $credit): static
  96.     {
  97.         if ($this->credits->removeElement($credit)) {
  98.             // set the owning side to null (unless already changed)
  99.             if ($credit->getReasonCode() === $this) {
  100.                 $credit->setReasonCode(null);
  101.             }
  102.         }
  103.         return $this;
  104.     }
  105.     /**
  106.      * @return Collection<int, ManualPayment>
  107.      */
  108.     public function getManualPayments(): Collection
  109.     {
  110.         return $this->manualPayments;
  111.     }
  112.     public function addManualPayment(ManualPayment $manualPayment): static
  113.     {
  114.         if (!$this->manualPayments->contains($manualPayment)) {
  115.             $this->manualPayments->add($manualPayment);
  116.             $manualPayment->setReasonCode($this);
  117.         }
  118.         return $this;
  119.     }
  120.     public function removeManualPayment(ManualPayment $manualPayment): static
  121.     {
  122.         if ($this->manualPayments->removeElement($manualPayment)) {
  123.             // set the owning side to null (unless already changed)
  124.             if ($manualPayment->getReasonCode() === $this) {
  125.                 $manualPayment->setReasonCode(null);
  126.             }
  127.         }
  128.         return $this;
  129.     }
  130.     public function __toString(): string
  131.     {
  132.         return $this->name;
  133.     }
  134. }