Default listeners for element annotations

Defines and attaches a set of default listeners for element annotations (which are defined on object properties). These include:

  • AllowEmpty
  • Attributes
  • ErrorMessage
  • Filter
  • Flags
  • Input
  • Hydrator
  • Object and Instance (the latter is preferred starting in 2.4)
  • Required
  • Type
  • Validator

See the individual annotation classes for more details. The handlers registered work with the annotation values, as well as the element and input specification passed in the event object.

 Methods

Attach one or more listeners

attach(\Zend\EventManager\EventManagerInterface $events) : void

Implementors may add an optional $priority argument; the EventManager implementation will pass this to the aggregate.

Parameters

Detach all previously attached listeners

detach(\Zend\EventManager\EventManagerInterface $events) : void
Inherited

inherited_from \Zend\EventManager\AbstractListenerAggregate::detach()
inherited_from \Zend\Form\Annotation\AbstractAnnotationsListener::detach()

Parameters

Discover the fallback name via reflection

discoverFallbackName(\Zend\EventManager\EventInterface $e) : string
Inherited

inherited_from \Zend\Form\Annotation\AbstractAnnotationsListener::discoverFallbackName()

Parameters

Returns

string

Handle the AllowEmpty annotation

handleAllowEmptyAnnotation(\Zend\EventManager\EventInterface $e) : void

Sets the allow_empty flag on the input specification array.

Parameters

Handle the Attributes annotation

handleAttributesAnnotation(\Zend\EventManager\EventInterface $e) : void

Sets the attributes array of the element specification.

Parameters

Allow creating fieldsets from composed entity properties

handleComposedObjectAnnotation(\Zend\EventManager\EventInterface $e) : void

Handle the ContinueIfEmpty annotation

handleContinueIfEmptyAnnotation(\Zend\EventManager\EventInterface $e) : void

Sets the continue_if_empty flag on the input specification array.

Parameters

Handle the ErrorMessage annotation

handleErrorMessageAnnotation(\Zend\EventManager\EventInterface $e) : void

Sets the error_message of the input specification.

Parameters

Determine if the element has been marked to exclude from the definition

handleExcludeAnnotation(\Zend\EventManager\EventInterface $e) : bool

Parameters

Returns

bool

Handle the Filter annotation

handleFilterAnnotation(\Zend\EventManager\EventInterface $e) : void

Adds a filter to the filter chain specification for the input.

Parameters

Handle the Flags annotation

handleFlagsAnnotation(\Zend\EventManager\EventInterface $e) : void

Sets the element flags in the specification (used typically for setting priority).

Parameters

Handle the Hydrator annotation

handleHydratorAnnotation(\Zend\EventManager\EventInterface $e) : void

Sets the hydrator class to use in the fieldset specification.

Parameters

Handle the Input annotation

handleInputAnnotation(\Zend\EventManager\EventInterface $e) : void

Sets the filter specification for the current element to the specified input class name.

Parameters

Attempt to discover a name set via annotation

handleNameAnnotation(\Zend\EventManager\EventInterface $e) : false | string
Inherited

inherited_from \Zend\Form\Annotation\AbstractAnnotationsListener::handleNameAnnotation()

Parameters

Returns

falsestring

Handle the Object and Instance annotations

handleObjectAnnotation(\Zend\EventManager\EventInterface $e) : void

Sets the object to bind to the form or fieldset

Parameters

Handle the Options annotation

handleOptionsAnnotation(\Zend\EventManager\EventInterface $e) : void

Sets the element options in the specification.

Parameters

Handle the Required annotation

handleRequiredAnnotation(\Zend\EventManager\EventInterface $e) : void

Sets the required flag on the input based on the annotation value.

Parameters

Handle the Type annotation

handleTypeAnnotation(\Zend\EventManager\EventInterface $e) : void

Sets the element class type to use in the element specification.

Parameters

Handle the Validator annotation

handleValidatorAnnotation(\Zend\EventManager\EventInterface $e) : void

Adds a validator to the validator chain of the input specification.

Parameters

mergeOptions()

mergeOptions(array | \ArrayAccess $elementSpec, \Zend\Form\Annotation\ComposedObject | \Zend\Form\Annotation\Options $annotation) : array

Parameters

$elementSpec

array\ArrayAccess

Returns

array

 Properties

 

$listeners

$listeners : \Zend\Stdlib\CallbackHandler[]
Inherited

inherited_from \Zend\EventManager\AbstractListenerAggregate::$$listeners
inherited_from \Zend\Form\Annotation\AbstractAnnotationsListener::$$listeners