createdAt; } public function getCreatedBy(): ?User { return $this->createdBy; } public function getFromPerson(): ?Person { return $this->fromPerson; } public function getId(): ?int { return $this->id; } /** * Return the opposite person of the @see{counterpart} person. * * this is the from person if the given is associated to the To, * or the To person otherwise. * * @throw RuntimeException if the counterpart is neither in the from or to person */ public function getOpposite(Person $counterpart): Person { if ($this->fromPerson !== $counterpart && $this->toPerson !== $counterpart) { throw new RuntimeException('the counterpart is neither the from nor to person for this relationship'); } if ($this->fromPerson === $counterpart) { return $this->toPerson; } return $this->fromPerson; } public function getRelation(): ?Relation { return $this->relation; } public function getReverse(): ?bool { return $this->reverse; } public function getToPerson(): ?Person { return $this->toPerson; } public function getUpdatedAt(): ?DateTimeImmutable { return $this->updatedAt; } public function getUpdatedBy(): ?User { return $this->updatedBy; } public function setCreatedAt(DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function setCreatedBy(?User $user): self { $this->createdBy = $user; return $this; } public function setFromPerson(?Person $fromPerson): self { $this->fromPerson = $fromPerson; return $this; } public function setRelation(?Relation $relation): self { $this->relation = $relation; return $this; } public function setReverse(bool $reverse): self { $this->reverse = $reverse; return $this; } public function setToPerson(?Person $toPerson): self { $this->toPerson = $toPerson; return $this; } public function setUpdatedAt(?DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } public function setUpdatedBy(?User $updatedBy): self { $this->updatedBy = $updatedBy; return $this; } }