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

package Default

 Methods

Create a form from an object.

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

Parameters

$entity

stringobject

Returns

\Zend\Form\Form

Retrieve annotation manager

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

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

Returns

\Zend\Code\Annotation\AnnotationManager

getAnnotationParser()

getAnnotationParser() : \Zend\Code\Annotation\Parser\DoctrineAnnotationParser

Returns

\Zend\Code\Annotation\Parser\DoctrineAnnotationParser

Get the entity used to construct the form.

getEntity() : object

Returns

object

Get event manager

getEventManager() : \Zend\EventManager\EventManagerInterface

Returns

\Zend\EventManager\EventManagerInterface

Retrieve form factory

getFormFactory() : \Zend\Form\Factory

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

Returns

\Zend\Form\Factory

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

\ArrayObject

preserveDefinedOrder()

preserveDefinedOrder() : boolean

Returns

boolean

Set annotation manager to use when building form from annotations

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

Parameters

$annotationManager

\Zend\Code\Annotation\AnnotationManager

Returns

\Zend\Form\Annotation\AnnotationBuilder

Set event manager instance

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

Parameters

$events

\Zend\EventManager\EventManagerInterface

Returns

\Zend\Form\Annotation\AnnotationBuilder

Set form factory to use when building form from annotations

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

Parameters

$formFactory

\Zend\Form\Factory

Returns

\Zend\Form\Annotation\AnnotationBuilder

setPreserveDefinedOrder()

setPreserveDefinedOrder(boolean $preserveDefinedOrder) : \Zend\Form\Annotation\AnnotationBuilder
fluent This method is part of a fluent interface and will return the same instance

Parameters

$preserveDefinedOrder

boolean

Returns

\Zend\Form\Annotation\AnnotationBuilder

Determine if an element is marked to exclude from the definitions

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

Parameters

$annotations

\Zend\Code\Annotation\AnnotationCollection

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

$annotations

\Zend\Code\Annotation\AnnotationCollection

$reflection

\Zend\Code\Reflection\PropertyReflection

$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

$annotations

\Zend\Code\Annotation\AnnotationCollection

$reflection

\Zend\Code\Reflection\ClassReflection

$formSpec

\ArrayObject

$filterSpec

\ArrayObject

Discover the name of the given form or element

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

Parameters

$annotations

\Zend\Code\Annotation\AnnotationCollection

$reflection

\Reflector

Returns

string

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

isSubclassOf(string $className, string $type) : boolean
Static
see
see
deprecated since zf 2.3 requires PHP >= 5.3.23

Parameters

$className

string

$type

string

Returns

boolean

 Properties

 

$annotationManager

$annotationManager : \Zend\Code\Annotation\AnnotationManager

Default

 

$annotationParser

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

Default

 

Default annotations to register

$defaultAnnotations : array

Default

array('AllowEmpty', 'Attributes', 'ComposedObject', 'ContinueIfEmpty', 'ErrorMessage', 'Exclude', 'Filter', 'Flags', 'Hydrator', 'Input', 'InputFilter', 'Instance', 'Name', 'Object', 'Options', 'Required', 'Type', 'ValidationGroup', 'Validator')
 

$entity

$entity : object

Default

 

$events

$events : \Zend\EventManager\EventManagerInterface

Default

 

$formFactory

$formFactory : \Zend\Form\Factory

Default

 

$preserveDefinedOrder

$preserveDefinedOrder : boolean

Default

false