src/Entity/Rule.php line 16
<?phpnamespace App\Entity;use App\Enum\RuleType;use App\Enum\RuleRateType;use App\Enum\RuleMultiplier;use App\Repository\RuleRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Gedmo\Timestampable\Traits\TimestampableEntity;#[ORM\Entity(repositoryClass: RuleRepository::class)]class Rule{use TimestampableEntity;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255, nullable: true)]private ?string $name = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $description = null;#[ORM\Column(length: 255, nullable: true)]private ?RuleType $type = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $activeStartDate = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $activeEndDate = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $effectiveStartDate = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $effectiveEndDate = null;#[ORM\Column(length: 255, nullable: true)]private ?string $inputType = null;#[ORM\Column(length: 255, nullable: true)]private ?RuleMultiplier $multiplier = null;#[ORM\Column(length: 255, nullable: true)]private ?RuleRateType $rateType = null;#[ORM\ManyToOne(inversedBy: 'rules')]private ?NamedRelationship $namedRelationship = null;#[ORM\Column]private ?bool $rollableOnReporting = null;#[ORM\OneToMany(mappedBy: 'rule', targetEntity: RuleVersion::class)]private Collection $ruleVersions;#[ORM\OneToMany(mappedBy: 'rule', targetEntity: RuleResult::class)]private Collection $ruleResults;#[ORM\ManyToMany(targetEntity: Plan::class, mappedBy: 'rules')]private Collection $plans;public function __construct(){$this->ruleVersions = new ArrayCollection();$this->ruleResults = new ArrayCollection();$this->plans = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getName(): ?string{return $this->name;}public function setName(?string $name): self{$this->name = $name;return $this;}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): self{$this->description = $description;return $this;}public function getType(): ?RuleType{return $this->type;}public function setType(?RuleType $type): self{$this->type = $type;return $this;}public function getActiveStartDate(): ?\DateTimeInterface{return $this->activeStartDate;}public function setActiveStartDate(?\DateTimeInterface $activeStartDate): self{$this->activeStartDate = $activeStartDate;return $this;}public function getActiveEndDate(): ?\DateTimeInterface{return $this->activeEndDate;}public function setActiveEndDate(?\DateTimeInterface $activeEndDate): self{$this->activeEndDate = $activeEndDate;return $this;}public function getEffectiveEndDate(): ?\DateTimeInterface{return $this->effectiveEndDate;}public function setEffectiveEndDate(?\DateTimeInterface $effectiveEndDate): self{$this->effectiveEndDate = $effectiveEndDate;return $this;}public function getInputType(): ?string{return $this->inputType;}public function setInputType(?string $inputType): self{$this->inputType = $inputType;return $this;}public function getMultiplier(): ?RuleMultiplier{return $this->multiplier;}public function setMultiplier(?RuleMultiplier $multiplier): self{$this->multiplier = $multiplier;return $this;}public function getRateType(): ?RuleRateType{return $this->rateType;}public function setRateType(?RuleRateType $rateType): self{$this->rateType = $rateType;return $this;}public function getNamedRelationship(): ?NamedRelationship{return $this->namedRelationship;}public function setNamedRelationship(?NamedRelationship $namedRelationship): self{$this->namedRelationship = $namedRelationship;return $this;}public function isRollableOnReporting(): ?bool{return $this->rollableOnReporting;}public function setRollableOnReporting(bool $rollableOnReporting): self{$this->rollableOnReporting = $rollableOnReporting;return $this;}/*** @return Collection<int, RuleVersion>*/public function getRuleVersions(): Collection{return $this->ruleVersions;}public function addRuleVersion(RuleVersion $ruleVersion): self{if (!$this->ruleVersions->contains($ruleVersion)) {$this->ruleVersions->add($ruleVersion);$ruleVersion->setRule($this);}return $this;}public function removeRuleVersion(RuleVersion $ruleVersion): self{if ($this->ruleVersions->removeElement($ruleVersion)) {// set the owning side to null (unless already changed)if ($ruleVersion->getRule() === $this) {$ruleVersion->setRule(null);}}return $this;}/*** @return Collection<int, RuleResult>*/public function getRuleResults(): Collection{return $this->ruleResults;}public function addRuleResult(RuleResult $ruleResult): static{if (!$this->ruleResults->contains($ruleResult)) {$this->ruleResults->add($ruleResult);$ruleResult->setRule($this);}return $this;}public function removeRuleResult(RuleResult $ruleResult): static{if ($this->ruleResults->removeElement($ruleResult)) {// set the owning side to null (unless already changed)if ($ruleResult->getRule() === $this) {$ruleResult->setRule(null);}}return $this;}/*** @return Collection<int, Plan>*/public function getPlans(): Collection{return $this->plans;}public function addPlan(Plan $plan): static{if (!$this->plans->contains($plan)) {$this->plans->add($plan);$plan->addRule($this);}return $this;}public function removePlan(Plan $plan): static{if ($this->plans->removeElement($plan)) {$plan->removeRule($this);}return $this;}public function __toString(): string{return $this->getName();return sprintf('%s - %s', $this->getName(), $this->getType()->title());}}