src/Entity/HierarchyVersion.php line 15
<?phpnamespace App\Entity;use Doctrine\DBAL\Types\Types;use App\Repository\HierarchyVersionRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use App\Validator\Constraints as AppAssert;use Gedmo\Timestampable\Traits\TimestampableEntity;#[ORM\Entity(repositoryClass: HierarchyVersionRepository::class)]#[AppAssert\LatestHierarchyVersionConstraint]class HierarchyVersion{use TimestampableEntity;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\OneToMany(mappedBy: 'hierarchyVersion', targetEntity: Hierarchy::class, orphanRemoval: true, fetch: 'EAGER', cascade: ['persist', 'remove'])]private Collection $hierarchies;#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]private ?\DateTimeInterface $effectiveStartDate = null;#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]private ?\DateTimeInterface $effectiveEndDate = null;public function __construct(){$this->hierarchies = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getName(): ?string{return $this->name;}public function setName(string $name): static{$this->name = $name;return $this;}/*** @return Collection<int, Hierarchy>*/public function getHierarchies(): Collection{return $this->hierarchies;}public function addHierarchy(Hierarchy $hierarchy): static{if (!$this->hierarchies->contains($hierarchy)) {$this->hierarchies->add($hierarchy);$hierarchy->setHierarchyVersion($this);}return $this;}public function removeHierarchy(Hierarchy $hierarchy): static{if ($this->hierarchies->removeElement($hierarchy)) {// set the owning side to null (unless already changed)if ($hierarchy->getHierarchyVersion() === $this) {$hierarchy->setHierarchyVersion(null);}}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 __toString(){return (string) $this->name;}}