src/Entity/RuleVersion.php line 13
<?phpnamespace App\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use App\Repository\RuleVersionRepository;use Doctrine\ORM\Mapping as ORM;use Gedmo\Timestampable\Traits\TimestampableEntity;#[ORM\Entity(repositoryClass: RuleVersionRepository::class)]class RuleVersion{use TimestampableEntity;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\ManyToOne(inversedBy: 'ruleVersions')]#[ORM\JoinColumn(nullable: false)]private ?Rule $rule = null;#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]private ?\DateTimeInterface $effectiveStartDate = null;#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]private ?\DateTimeInterface $effectiveEndDate = 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\ManyToOne(inversedBy: 'ruleVersions', fetch: 'EAGER')]private ?AttainmentMeasure $attainmentMeasure = null;#[ORM\Column]private ?bool $isMaster = false;#[ORM\OneToMany(mappedBy: 'ruleVersion', targetEntity: RuleCondition::class, orphanRemoval: true)]private Collection $ruleConditions;public function __construct(){$this->ruleConditions = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getRule(): ?Rule{return $this->rule;}public function setRule(?Rule $rule): self{$this->rule = $rule;return $this;}public function getEffectiveStartDate(): ?\DateTimeInterface{return $this->effectiveStartDate;}public function setEffectiveStartDate(?\DateTimeInterface $effectiveStartDate): static{$this->effectiveStartDate = $effectiveStartDate;return $this;}public function getEffectiveEndDate(): ?\DateTimeInterface{return $this->effectiveEndDate;}public function setEffectiveEndDate(?\DateTimeInterface $effectiveEndDate): static{$this->effectiveEndDate = $effectiveEndDate;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 getAttainmentMeasure(): ?AttainmentMeasure{return $this->attainmentMeasure;}public function setAttainmentMeasure(?AttainmentMeasure $attainmentMeasure): self{$this->attainmentMeasure = $attainmentMeasure;return $this;}public function isIsMaster(): ?bool{return $this->isMaster;}public function setIsMaster(bool $isMaster): self{$this->isMaster = $isMaster;return $this;}/*** @return Collection<int, RuleCondition>*/public function getRuleConditions(): Collection{return $this->ruleConditions;}public function addRuleCondition(RuleCondition $ruleCondition): self{if (!$this->ruleConditions->contains($ruleCondition)) {$this->ruleConditions->add($ruleCondition);$ruleCondition->setRuleVersion($this);}return $this;}public function removeRuleCondition(RuleCondition $ruleCondition): self{if ($this->ruleConditions->removeElement($ruleCondition)) {// set the owning side to null (unless already changed)if ($ruleCondition->getRuleVersion() === $this) {$ruleCondition->setRuleVersion(null);}}return $this;}public function __toString(): string{$endDate = $this->effectiveEndDate ? $this->effectiveEndDate->format('Y-m-d') : 'EOD';return sprintf('[%s] %s (%s - %s)', $this->getRule()->getId(), $this->getRule()->getName(), $this->getEffectiveStartDate()->format('m/d/Y'), $endDate);}}