public function getRelatedByName($name) { if ($this->isRelated($name, $this)) { return $this; } foreach ($this->getRecursiveIterator() as $exception) { if ($this->isRelated($name, $exception)) { return $exception; } } }