Zend Framework  3.0
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
AnnotationBuilder Class Reference

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

Public Member Functions

 setFormFactory (Factory $formFactory)
 Set form factory to use when building form from annotations.
 
 setAnnotationManager (AnnotationManager $annotationManager)
 Set annotation manager to use when building form from annotations.
 
 setEventManager (EventManagerInterface $events)
 Set event manager instance.
 
 getFormFactory ()
 Retrieve form factory.
 
 getAnnotationManager ()
 Retrieve annotation manager.
 
 getEventManager ()
 Get event manager.
 
 getFormSpecification ($entity)
 Creates and returns a form specification for use with a factory.
 
 createForm ($entity)
 Create a form from an object.
 
 getEntity ()
 Get the entity used to construct the form.
 
 setPreserveDefinedOrder ($preserveDefinedOrder)
 
 preserveDefinedOrder ()
 
 getAnnotationParser ()
 

Protected Member Functions

 configureForm ($annotations, $reflection, $formSpec, $filterSpec)
 Configure the form specification from annotations.
 
 configureElement ($annotations, $reflection, $formSpec, $filterSpec)
 Configure an element from annotations.
 
 discoverName ($annotations, $reflection)
 Discover the name of the given form or element.
 
 checkForExclude ($annotations)
 Determine if an element is marked to exclude from the definitions.
 

Static Protected Member Functions

static isSubclassOf ($className, $type)
 Checks if the object has this class as one of its parents.
 

Protected Attributes

 $annotationParser
 
 $annotationManager
 
 $events
 
 $formFactory
 
 $entity
 
 $defaultAnnotations
 
 $preserveDefinedOrder = false
 

Detailed Description

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

Member Function Documentation

checkForExclude (   $annotations)
protected

Determine if an element is marked to exclude from the definitions.

Parameters
AnnotationCollection$annotations
Returns
true|false
configureElement (   $annotations,
  $reflection,
  $formSpec,
  $filterSpec 
)
protected

Configure an element from annotations.

Parameters
AnnotationCollection$annotations
\Zend\Code\Reflection\PropertyReflection$reflection
ArrayObject$formSpec
ArrayObject$filterSpec
Returns
void checkForExclude discoverName configureElement
configureForm (   $annotations,
  $reflection,
  $formSpec,
  $filterSpec 
)
protected

Configure the form specification from annotations.

Parameters
AnnotationCollection$annotations
ClassReflection$reflection
ArrayObject$formSpec
ArrayObject$filterSpec
Returns
void discoverName configureForm
createForm (   $entity)

Create a form from an object.

Parameters
string | object$entity
Returns
discoverName (   $annotations,
  $reflection 
)
protected

Discover the name of the given form or element.

Parameters
AnnotationCollection$annotations
\Reflector$reflection
Returns
string
getAnnotationManager ( )

Retrieve annotation manager.

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

Returns
AnnotationManager
getAnnotationParser ( )
Returns
getEntity ( )

Get the entity used to construct the form.

Returns
object
getEventManager ( )

Get event manager.

Returns
EventManagerInterface

Implements EventsCapableInterface.

getFormFactory ( )

Retrieve form factory.

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

Returns
Factory
getFormSpecification (   $entity)

Creates and returns a form specification for use with a factory.

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
string | object$entityEither an instance or a valid class name for an entity
Exceptions
Exception\InvalidArgumentExceptionif $entity is not an object or class name
Returns
ArrayObject
static isSubclassOf (   $className,
  $type 
)
staticprotected

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

See Also
https://bugs.php.net/bug.php?id=53727
https://github.com/zendframework/zf2/pull/1807
Deprecated:
since zf 2.3 requires PHP >= 5.3.23
Parameters
string$className
string$type
Returns
bool
preserveDefinedOrder ( )
Returns
bool
setAnnotationManager ( AnnotationManager  $annotationManager)

Set annotation manager to use when building form from annotations.

Parameters
AnnotationManager$annotationManager
Returns
AnnotationBuilder
setEventManager ( EventManagerInterface  $events)

Set event manager instance.

Parameters
EventManagerInterface$events
Returns
AnnotationBuilder

Implements EventManagerAwareInterface.

setFormFactory ( Factory  $formFactory)

Set form factory to use when building form from annotations.

Parameters
Factory$formFactory
Returns
AnnotationBuilder

Implements FormFactoryAwareInterface.

setPreserveDefinedOrder (   $preserveDefinedOrder)
Parameters
bool$preserveDefinedOrder
Returns
$this

Member Data Documentation

$annotationManager
protected
$annotationParser
protected
$defaultAnnotations
protected
Initial value:
= [
'AllowEmpty',
'Attributes',
'ComposedObject',
'ContinueIfEmpty',
'ErrorMessage',
'Exclude',
'Filter',
'Flags',
'Hydrator',
'Input',
'InputFilter',
'Instance',
'Name',
'Object',
'Options',
'Required',
'Type',
'ValidationGroup',
'Validator'
]
$entity
protected
$events
protected
$formFactory
protected
$preserveDefinedOrder = false
protected