public function getRoot() { $parent = $this->getParent(); if (NULL === $parent || $this === $parent) { return $this; } return $parent->getRoot(); }