listeners[] = $events->attach('configureForm', array($this, 'handleAttributesAnnotation')); $this->listeners[] = $events->attach('configureForm', array($this, 'handleFlagsAnnotation')); $this->listeners[] = $events->attach('configureForm', array($this, 'handleHydratorAnnotation')); $this->listeners[] = $events->attach('configureForm', array($this, 'handleInputFilterAnnotation')); $this->listeners[] = $events->attach('configureForm', array($this, 'handleObjectAnnotation')); $this->listeners[] = $events->attach('configureForm', array($this, 'handleOptionsAnnotation')); $this->listeners[] = $events->attach('configureForm', array($this, 'handleTypeAnnotation')); $this->listeners[] = $events->attach('configureForm', array($this, 'handleValidationGroupAnnotation')); $this->listeners[] = $events->attach('discoverName', array($this, 'handleNameAnnotation')); $this->listeners[] = $events->attach('discoverName', array($this, 'discoverFallbackName')); } /** * Handle the Attributes annotation * * Sets the attributes key of the form specification. * * @param \Zend\EventManager\EventInterface $e * @return void */ public function handleAttributesAnnotation($e) { $annotation = $e->getParam('annotation'); if (!$annotation instanceof Attributes) { return; } $formSpec = $e->getParam('formSpec'); $formSpec['attributes'] = $annotation->getAttributes(); } /** * Handle the Flags annotation * * Sets the flags key of the form specification. * * @param \Zend\EventManager\EventInterface $e * @return void */ public function handleFlagsAnnotation($e) { $annotation = $e->getParam('annotation'); if (!$annotation instanceof Flags) { return; } $formSpec = $e->getParam('formSpec'); $formSpec['flags'] = $annotation->getFlags(); } /** * Handle the Hydrator annotation * * Sets the hydrator class to use in the form specification. * * @param \Zend\EventManager\EventInterface $e * @return void */ public function handleHydratorAnnotation($e) { $annotation = $e->getParam('annotation'); if (!$annotation instanceof Hydrator) { return; } $formSpec = $e->getParam('formSpec'); $formSpec['hydrator'] = $annotation->getHydrator(); } /** * Handle the InputFilter annotation * * Sets the input filter class to use in the form specification. * * @param \Zend\EventManager\EventInterface $e * @return void */ public function handleInputFilterAnnotation($e) { $annotation = $e->getParam('annotation'); if (!$annotation instanceof InputFilter) { return; } $formSpec = $e->getParam('formSpec'); $formSpec['input_filter'] = $annotation->getInputFilter(); } /** * Handle the Object annotation * * Sets the object to bind to the form or fieldset * * @param \Zend\EventManager\EventInterface $e * @return void */ public function handleObjectAnnotation($e) { $annotation = $e->getParam('annotation'); if (!$annotation instanceof Object) { return; } $formSpec = $e->getParam('formSpec'); $formSpec['object'] = $annotation->getObject(); } /** * Handle the Options annotation * * Sets the options key of the form specification. * * @param \Zend\EventManager\EventInterface $e * @return void */ public function handleOptionsAnnotation($e) { $annotation = $e->getParam('annotation'); if (!$annotation instanceof Options) { return; } $formSpec = $e->getParam('formSpec'); $formSpec['options'] = $annotation->getOptions(); } /** * Handle the Type annotation * * Sets the form class to use in the form specification. * * @param \Zend\EventManager\EventInterface $e * @return void */ public function handleTypeAnnotation($e) { $annotation = $e->getParam('annotation'); if (!$annotation instanceof Type) { return; } $formSpec = $e->getParam('formSpec'); $formSpec['type'] = $annotation->getType(); } /** * Handle the ValidationGroup annotation * * Sets the validation group to use in the form specification. * * @param \Zend\EventManager\EventInterface $e * @return void */ public function handleValidationGroupAnnotation($e) { $annotation = $e->getParam('annotation'); if (!$annotation instanceof ValidationGroup) { return; } $formSpec = $e->getParam('formSpec'); $formSpec['validation_group'] = $annotation->getValidationGroup(); } }