parentComponent = $component; return $this; } public function getParentComponent(): ?Component { return $this->parentComponent; } public function getInfolist(): Infolist { if ($this instanceof Infolist) { return $this; } $parentComponent = $this->getParentComponent(); if (! $parentComponent) { throw new Exception('Tried to access a non-existent root infolist of a component.'); } return $parentComponent->getInfolist(); } }