public function findRelated($path) { $target = $this; $pieces = explode('.', $path); while (!empty($pieces) && $target) { $piece = array_shift($pieces); $target = $target->getRelatedByName($piece); } return $target; }