src/Entity/RuleConditionOld.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\BooleanType;
  4. use App\Enum\InternalCondition;
  5. use App\Repository\RuleConditionOldRepository;
  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(repositoryClassRuleConditionOldRepository::class)]
  11. #[ORM\Table(name'rule_conditions_old')]
  12. class RuleConditionOld
  13. {
  14.     use TimestampableEntity;
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\ManyToOne(inversedBy'creditRuleConditions')]
  20.     #[ORM\JoinColumn(nullabletrue)]
  21.     private ?CreditRule $creditRule null;
  22.     #[ORM\Column]
  23.     private ?InternalCondition $internalCondition null;
  24.     #[ORM\Column(length255nullabletrue)]
  25.     private ?string $equalsValue null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     private ?string $equalsValueType null;
  28.     #[ORM\Column]
  29.     private ?BooleanType $conditionBooleanType BooleanType::AND;
  30.     #[ORM\ManyToOne(inversedBy'ruleConditionsOld')]
  31.     private ?CommissionRule $commissionRule null;
  32.     #[ORM\ManyToMany(targetEntityCreditType::class, cascade: ['persist'])]
  33.     private Collection $creditTypes;
  34.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'children')]
  35.     private ?self $parent null;
  36.     #[ORM\OneToMany(mappedBy'parent'targetEntityself::class, cascade: ['persist''remove'])]
  37.     private Collection $children;
  38.     #[ORM\ManyToOne(inversedBy'ruleConditionsOld')]
  39.     #[ORM\JoinColumn(nullablefalse)]
  40.     private ?Year $year null;
  41.     public function __construct()
  42.     {
  43.         $this->creditTypes = new ArrayCollection();
  44.         $this->children = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getCreditRule(): ?CreditRule
  51.     {
  52.         return $this->creditRule;
  53.     }
  54.     public function setCreditRule($creditRule): self
  55.     {
  56.         $this->creditRule $creditRule;
  57.         return $this;
  58.     }
  59.     public function getInternalCondition()
  60.     {
  61.         return $this->internalCondition;
  62.     }
  63.     public function setInternalCondition(InternalCondition $internalCondition): self
  64.     {
  65.         $this->internalCondition $internalCondition;
  66.         return $this;
  67.     }
  68.     public function getEqualsValue(): ?string
  69.     {
  70.         return $this->equalsValue;
  71.     }
  72.     public function setEqualsValue(?string $equalsValue): self
  73.     {
  74.         $this->equalsValue $equalsValue;
  75.         return $this;
  76.     }
  77.     public function getEqualsValueType(): ?string
  78.     {
  79.         return $this->equalsValueType;
  80.     }
  81.     public function setEqualsValueType(?string $equalsValueType): self
  82.     {
  83.         $this->equalsValueType $equalsValueType;
  84.         return $this;
  85.     }
  86.     public function getConditionBooleanType()
  87.     {
  88.         return $this->conditionBooleanType;
  89.     }
  90.     public function setConditionBooleanType(BooleanType $conditionBooleanType): self
  91.     {
  92.         $this->conditionBooleanType $conditionBooleanType;
  93.         return $this;
  94.     }
  95.     public function getCommissionRule(): ?CommissionRule
  96.     {
  97.         return $this->commissionRule;
  98.     }
  99.     public function setCommissionRule(?CommissionRule $commissionRule): self
  100.     {
  101.         $this->commissionRule $commissionRule;
  102.         return $this;
  103.     }
  104.     /**
  105.      * @return Collection<int, CreditType>
  106.      */
  107.     public function getCreditTypes(): Collection
  108.     {
  109.         return $this->creditTypes;
  110.     }
  111.     public function addCreditType(CreditType $creditType): self
  112.     {
  113.         if (!$this->creditTypes->contains($creditType)) {
  114.             $this->creditTypes->add($creditType);
  115.         }
  116.         return $this;
  117.     }
  118.     public function removeCreditType(CreditType $creditType): self
  119.     {
  120.         $this->creditTypes->removeElement($creditType);
  121.         return $this;
  122.     }
  123.     public function getParent(): ?self
  124.     {
  125.         return $this->parent;
  126.     }
  127.     public function setParent(?self $parent): self
  128.     {
  129.         $this->parent $parent;
  130.         return $this;
  131.     }
  132.     /**
  133.      * @return Collection<int, self>
  134.      */
  135.     public function getChildren(): Collection
  136.     {
  137.         return $this->children;
  138.     }
  139.     public function addChild(self $child): self
  140.     {
  141.         if (!$this->children->contains($child)) {
  142.             $this->children->add($child);
  143.             $child->setParent($this);
  144.         }
  145.         return $this;
  146.     }
  147.     public function removeChild(self $child): self
  148.     {
  149.         if ($this->children->removeElement($child)) {
  150.             // set the owning side to null (unless already changed)
  151.             if ($child->getParent() === $this) {
  152.                 $child->setParent(null);
  153.             }
  154.         }
  155.         return $this;
  156.     }
  157.     public function getYear(): ?Year
  158.     {
  159.         return $this->year;
  160.     }
  161.     public function setYear(?Year $year): self
  162.     {
  163.         $this->year $year;
  164.         return $this;
  165.     }
  166. }