getParam('annotations'); if (!$annotations->hasAnnotation('Zend\Form\Annotation\Name')) { return false; } foreach ($annotations as $annotation) { if (!$annotation instanceof Name) { continue; } return $annotation->getName(); } return false; } /** * Discover the fallback name via reflection * * @param \Zend\EventManager\EventInterface $e * @return string */ public function discoverFallbackName($e) { $reflection = $e->getParam('reflection'); if ($reflection instanceof ReflectionClass) { return $reflection->getShortName(); } return $reflection->getName(); } }