/** * @return string * @throws Entity\InvalidDefinitionException */ public static function getClassNameOfEntityDefinition() { $class = new \ReflectionClass(get_called_class()); while ($class instanceof \ReflectionClass) { if (false !== strpos($class->getDocComment(), 'HynageEntityType')) { return $class->getName(); } $class = $class->getParentClass(); } throw new Entity\InvalidDefinitionException('Could not find class with table/field definition.'); }