/** * @param ForestField $field * @return bool|string * @throws CollectionNotFoundException */ protected function findRelatedEntityClassName($field) { $relationName = $field->getReferencedTable(); if ($relationName) { foreach ($this->getCollections() as $collection) { if ($collection->getName() == $relationName) { return $collection->getEntityClassName(); } } throw new CollectionNotFoundException($relationName); } return false; }