src/Entity/CreditRule.php line 15

  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\CreditRuleType;
  4. use App\Repository\CreditRuleRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Timestampable\Traits\TimestampableEntity;
  10. #[ORM\Entity(repositoryClassCreditRuleRepository::class)]
  11. class CreditRule
  12. {
  13.     use TimestampableEntity;
  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::INTEGERenumTypeCreditRuleType::class)]
  21.     private ?CreditRuleType $ruleType null;
  22.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  23.     private ?\DateTimeInterface $activeStartDate null;
  24.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  25.     private ?\DateTimeInterface $activeEndDate null;
  26.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  27.     private ?string $description null;
  28.     #[ORM\Column(nullabletrue)]
  29.     private ?bool $rollableOnReporting null;
  30.     #[ORM\OneToMany(mappedBy'creditRule'targetEntityRuleConditionOld::class, orphanRemovaltruecascade: ['persist'], fetch"EAGER")]
  31.     private Collection $creditRuleConditions;
  32.     #[ORM\ManyToOne]
  33.     #[ORM\JoinColumn(nullablefalse)]
  34.     private ?CreditRuleResultFormula $creditRuleResultFormula null;
  35.     #[ORM\ManyToOne]
  36.     private ?CreditType $creditType null;
  37.     #[ORM\ManyToMany(targetEntityCreditType::class, fetch'EAGER')]
  38.     private Collection $indirectCreditTypes;
  39.     #[ORM\ManyToOne(inversedBy'creditRules')]
  40.     #[ORM\JoinColumn(nullablefalse)]
  41.     private ?Year $year null;
  42.     public function __construct()
  43.     {
  44.         $this->creditRuleConditions = new ArrayCollection();
  45.         $this->indirectCreditTypes = new ArrayCollection();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getName(): ?string
  52.     {
  53.         return $this->name;
  54.     }
  55.     public function setName(string $name): self
  56.     {
  57.         $this->name $name;
  58.         return $this;
  59.     }
  60.     public function getRuleType() : ?CreditRuleType
  61.     {
  62.         return $this->ruleType;
  63.     }
  64.     public function setRuleType($ruleType): self
  65.     {
  66.         $this->ruleType $ruleType;
  67.         return $this;
  68.     }
  69.     public function getActiveStartDate(): ?\DateTimeInterface
  70.     {
  71.         return $this->activeStartDate;
  72.     }
  73.     public function setActiveStartDate(?\DateTimeInterface $activeStartDate): self
  74.     {
  75.         $this->activeStartDate $activeStartDate;
  76.         return $this;
  77.     }
  78.     public function getActiveEndDate(): ?\DateTimeInterface
  79.     {
  80.         return $this->activeEndDate;
  81.     }
  82.     public function setActiveEndDate(?\DateTimeInterface $activeEndDate): self
  83.     {
  84.         $this->activeEndDate $activeEndDate;
  85.         return $this;
  86.     }
  87.     public function getDescription(): ?string
  88.     {
  89.         return $this->description;
  90.     }
  91.     public function setDescription(?string $description): self
  92.     {
  93.         $this->description $description;
  94.         return $this;
  95.     }
  96.     public function isRollableOnReporting(): ?bool
  97.     {
  98.         return $this->rollableOnReporting;
  99.     }
  100.     public function setRollableOnReporting(?bool $rollableOnReporting): self
  101.     {
  102.         $this->rollableOnReporting $rollableOnReporting;
  103.         return $this;
  104.     }
  105.     /**
  106.      * @return Collection<int, RuleConditionOld>
  107.      */
  108.     public function getRuleConditions(): Collection
  109.     {
  110.         return $this->creditRuleConditions;
  111.     }
  112.     public function addRuleCondition(RuleConditionOld $ruleCondition): self
  113.     {
  114.         if (!$this->creditRuleConditions->contains($ruleCondition)) {
  115.             $this->creditRuleConditions->add($ruleCondition);
  116.             $ruleCondition->setCreditRule($this);
  117.         }
  118.         return $this;
  119.     }
  120.     public function removeRuleCondition(RuleConditionOld $ruleCondition): self
  121.     {
  122.         if ($this->creditRuleConditions->removeElement($ruleCondition)) {
  123.             // set the owning side to null (unless already changed)
  124.             if ($ruleCondition->getCreditRule() === $this) {
  125.                 $ruleCondition->setCreditRule(null);
  126.             }
  127.         }
  128.         return $this;
  129.     }
  130.     public function getCreditRuleResultFormula(): ?CreditRuleResultFormula
  131.     {
  132.         return $this->creditRuleResultFormula;
  133.     }
  134.     public function setCreditRuleResultFormula(?CreditRuleResultFormula $creditRuleResultFormula): self
  135.     {
  136.         $this->creditRuleResultFormula $creditRuleResultFormula;
  137.         return $this;
  138.     }
  139.     public function getCreditType(): ?CreditType
  140.     {
  141.         return $this->creditType;
  142.     }
  143.     public function setCreditType(?CreditType $creditType): self
  144.     {
  145.         $this->creditType $creditType;
  146.         return $this;
  147.     }
  148.     public function __toString()
  149.     {
  150.         return $this->name;
  151.     }
  152.     /**
  153.      * @return Collection<int, CreditType>
  154.      */
  155.     public function getIndirectCreditTypes(): Collection
  156.     {
  157.         return $this->indirectCreditTypes;
  158.     }
  159.     public function addIndirectCreditType(CreditType $indirectCreditType): self
  160.     {
  161.         if (!$this->indirectCreditTypes->contains($indirectCreditType)) {
  162.             $this->indirectCreditTypes->add($indirectCreditType);
  163.         }
  164.         return $this;
  165.     }
  166.     public function removeIndirectCreditType(CreditType $indirectCreditType): self
  167.     {
  168.         $this->indirectCreditTypes->removeElement($indirectCreditType);
  169.         return $this;
  170.     }
  171.     public function getYear(): ?Year
  172.     {
  173.         return $this->year;
  174.     }
  175.     public function setYear(?Year $year): self
  176.     {
  177.         $this->year $year;
  178.         return $this;
  179.     }
  180. }