Parses the properties of a class for annotations in order to create a form and input filter definition.

 Methods

Create a form from an object.

createForm(string | object $entity) : \Zend\Form\Form

Parameters

$entity

stringobject

Returns

Retrieve annotation manager

getAnnotationManager() : \Zend\Code\Annotation\AnnotationManager

If none is currently set, creates one with default annotations.

Returns

Get the entity used to construct the form.

getEntity() : object

Returns

object

Retrieve form factory

getFormFactory() : \Zend\Form\Factory

Lazy-loads the default form factory if none is currently set.

Returns

Creates and returns a form specification for use with a factory

getFormSpecification(string | object $entity) : \ArrayObject

Parses the object provided, and processes annotations for the class and all properties. Information from annotations is then used to create specifications for a form, its elements, and its input filter.

Parameters

$entity

stringobject

Either an instance or a valid class name for an entity

Exceptions

\Zend\Form\Exception\InvalidArgumentException if $entity is not an object or class name

Returns

preserveDefinedOrder()

preserveDefinedOrder() : bool

Returns

bool

Set annotation manager to use when building form from annotations

setAnnotationManager(\Zend\Code\Annotation\AnnotationManager $annotationManager) : \Zend\Form\Annotation\AnnotationBuilder

Set event manager instance

setEventManager(\Zend\EventManager\EventManagerInterface $events) : \Zend\Form\Annotation\AnnotationBuilder

Set form factory to use when building form from annotations

setFormFactory(\Zend\Form\Factory $formFactory) : \Zend\Form\Annotation\AnnotationBuilder

setPreserveDefinedOrder()

setPreserveDefinedOrder(bool $preserveDefinedOrder) : \Zend\Form\Annotation\$this

Parameters

$preserveDefinedOrder

bool

Returns

\Zend\Form\Annotation\$this

Determine if an element is marked to exclude from the definitions

checkForExclude(\Zend\Code\Annotation\AnnotationCollection $annotations) : true | false

Parameters

Returns

truefalse

Configure an element from annotations

configureElement(\Zend\Code\Annotation\AnnotationCollection $annotations, \Zend\Code\Reflection\PropertyReflection $reflection, \ArrayObject $formSpec, \ArrayObject $filterSpec) : void

triggers checkForExclude
triggers discoverName
triggers configureElement

Parameters

$formSpec

\ArrayObject

$filterSpec

\ArrayObject

Configure the form specification from annotations

configureForm(\Zend\Code\Annotation\AnnotationCollection $annotations, \Zend\Code\Reflection\ClassReflection $reflection, \ArrayObject $formSpec, \ArrayObject $filterSpec) : void

triggers discoverName
triggers configureForm

Parameters

$formSpec

\ArrayObject

$filterSpec

\ArrayObject

Discover the name of the given form or element

discoverName(\Zend\Code\Annotation\AnnotationCollection $annotations, \Reflector $reflection) : string

Parameters

$reflection

\Reflector

Returns

string

Checks if the object has this class as one of its parents

isSubclassOf(string $className, string $type) : bool

see \Zend\Form\Annotation\https://bugs.php.net/bug.php?id=53727
see \Zend\Form\Annotation\https://github.com/zendframework/zf2/pull/1807
deprecated since zf 2.3 requires PHP >= 5.3.23

Parameters

$className

string

$type

string

Returns

bool

 Properties

 

$annotationManager

$annotationManager : \Zend\Code\Annotation\AnnotationManager

 

$annotationParser

$annotationParser : \Zend\Code\Annotation\Parser\DoctrineAnnotationParser

 

<p>Default annotations to register</p>

$defaultAnnotations : array

 

$entity

$entity : object

   

$formFactory

$formFactory : \Zend\Form\Factory

 

$preserveDefinedOrder

$preserveDefinedOrder : bool