null])] private ?\DateTimeImmutable $endDate = null; #[ORM\Id] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; #[ORM\OneToOne(targetEntity: Person::class, inversedBy: 'centerCurrent')] private Person $person; #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: false)] private \DateTimeImmutable $startDate; /** * Populate the properties person, center, start and end date from history. * * The creator and updatedby are not filled. * * @internal Should not be instantied, unless inside Person entity */ public function __construct(PersonCenterHistory $history) { $this->person = $history->getPerson(); $this->center = $history->getCenter(); $this->startDate = $history->getStartDate(); $this->endDate = $history->getEndDate(); $this->id = $history->getId(); } public function getCenter(): Center { return $this->center; } public function getEndDate(): ?\DateTimeImmutable { return $this->endDate; } /** * The id will be the same as the current @see{PersonCenterHistory::class}. */ public function getId(): int { return $this->id; } public function getPerson(): Person { return $this->person; } public function getStartDate(): \DateTimeImmutable { return $this->startDate; } }