759. Class

759.1. Zend\Form\Factory

759.1.1. Methods

759.1.1.1. __construct

__construct()

@param FormElementManager $formElementManager

759.1.1.2. setInputFilterFactory

setInputFilterFactory()

Set input filter factory to use when creating forms

Parameters:InputFilterFactory
Return type:Factory

759.1.1.3. getInputFilterFactory

getInputFilterFactory()

Get current input filter factory

If none provided, uses an unconfigured instance.

Return type:InputFilterFactory

759.1.1.4. setFormElementManager

setFormElementManager()

Set the form element manager

Parameters:FormElementManager
Return type:Factory

759.1.1.5. getFormElementManager

getFormElementManager()

Get form element manager

Return type:FormElementManager

759.1.1.6. create

create()

Create an element, fieldset, or form

Introspects the ‘type’ key of the provided $spec, and determines what type is being requested; if none is provided, assumes the spec represents simply an element.

Parameters:array|Traversable
Return type:ElementInterface
Throws :ExceptionDomainException

759.1.1.7. createElement

createElement()

Create an element

Parameters:array
Return type:ElementInterface

759.1.1.8. createFieldset

createFieldset()

Create a fieldset

Parameters:array
Return type:ElementInterface

759.1.1.9. createForm

createForm()

Create a form

Parameters:array
Return type:ElementInterface

759.1.1.10. configureElement

configureElement()

Configure an element based on the provided specification

Specification can contain any of the following: - type: the Element class to use; defaults to ZendFormElement - name: what name to provide the element, if any - options: an array, Traversable, or ArrayAccess object of element options - attributes: an array, Traversable, or ArrayAccess object of element

attributes to assign
Parameters:
  • ElementInterface
  • array|Traversable|ArrayAccess
Throws ExceptionDomainException:
 
Return type:

ElementInterface

759.1.1.11. configureFieldset

configureFieldset()

Configure a fieldset based on the provided specification

Specification can contain any of the following: - type: the Fieldset class to use; defaults to ZendFormFieldset - name: what name to provide the fieldset, if any - options: an array, Traversable, or ArrayAccess object of element options - attributes: an array, Traversable, or ArrayAccess object of element

attributes to assign
  • elements: an array or Traversable object where each entry is an array or ArrayAccess object containing the keys: - flags: (optional) array of flags to pass to FieldsetInterface::add() - spec: the actual element specification, per {@link configureElement()}
Parameters:
  • FieldsetInterface
  • array|Traversable|ArrayAccess
Throws ExceptionDomainException:
 
Return type:

FieldsetInterface

759.1.1.12. configureForm

configureForm()

Configure a form based on the provided specification

Specification follows that of {@link configureFieldset()}, and adds the following keys:

  • input_filter: input filter instance, named input filter class, or array specification for the input filter factory
  • hydrator: hydrator instance or named hydrator class
Parameters:
  • FormInterface
  • array|Traversable|ArrayAccess
Return type:

FormInterface

759.1.1.13. validateSpecification

validateSpecification()

Validate a provided specification

Ensures we have an array, Traversable, or ArrayAccess object, and returns it.

Parameters:
  • array|Traversable|ArrayAccess
  • string – Method invoking the validator
Return type:

array|ArrayAccess

Throws :

ExceptionInvalidArgumentException for invalid $spec

759.1.1.14. prepareAndInjectElements

prepareAndInjectElements()

Takes a list of element specifications, creates the elements, and injects them into the provided fieldset

Parameters:
  • array|Traversable|ArrayAccess
  • FieldsetInterface
  • string – Method invoking this one (for exception messages)
Return type:

void

759.1.1.15. prepareAndInjectFieldsets

prepareAndInjectFieldsets()

Takes a list of fieldset specifications, creates the fieldsets, and injects them into the master fieldset

Parameters:
  • array|Traversable|ArrayAccess
  • FieldsetInterface
  • string – Method invoking this one (for exception messages)
Return type:

void

759.1.1.16. prepareAndInjectObject

prepareAndInjectObject()

Prepare and inject an object

Takes a string indicating a class name, instantiates the class by that name, and injects the class instance as the bound object.

Parameters:
  • string
  • FieldsetInterface
  • string
Throws ExceptionDomainException:
 
Return type:

void

759.1.1.17. prepareAndInjectHydrator

prepareAndInjectHydrator()

Prepare and inject a named hydrator

Takes a string indicating a hydrator class name (or a concrete instance), try first to instantiates the class by pulling it from service manager, and injects the hydrator instance into the form.

Parameters:
  • string|array|HydratorHydratorInterface
  • FieldsetInterface
  • string
Return type:

void

Throws :

ExceptionDomainException If $hydratorOrName is not a string, does not resolve to a known class, or the class does not implement HydratorHydratorInterface

759.1.1.18. prepareAndInjectInputFilter

prepareAndInjectInputFilter()

Prepare an input filter instance and inject in the provided form

If the input filter specified is a string, assumes it is a class name, and attempts to instantiate it. If the class does not exist, or does not extend InputFilterInterface, an exception is raised.

Otherwise, $spec is passed on to the attached InputFilter Factory instance in order to create the input filter.

Parameters:
  • string|array|Traversable
  • FormInterface
  • string
Return type:

void

Throws :

ExceptionDomainException for unknown InputFilter class or invalid InputFilter instance

759.1.1.19. prepareAndInjectValidationGroup

prepareAndInjectValidationGroup()

Prepare a validation group and inject in the provided form

Takes an array of elements names

Parameters:
  • string|array|Traversable
  • FormInterface
  • string
Return type:

void

Throws :

ExceptionDomainException if validation group given is not an array

759.1.1.20. getHydratorFromName

getHydratorFromName()

Try to pull hydrator from service manager, or instantiates it from its name

Parameters:string
Return type:mixed
Throws :ExceptionDomainException