422. Class

422.1. Zend\Form\Element\Collection

422.1.1. Methods

422.1.1.1. setOptions

setOptions()

Accepted options for Collection: - target_element: an array or element used in the collection - count: number of times the element is added initially - allow_add: if set to true, elements can be added to the form dynamically (using JavaScript) - allow_remove: if set to true, elements can be removed to the form - should_create_template: if set to true, a template is generated (inside a <span>) - template_placeholder: placeholder used in the data template

Parameters:array|Traversable
Return type:Collection

422.1.1.2. allowObjectBinding

allowObjectBinding()

Checks if the object can be set in this fieldset

Parameters:object
Return type:bool

422.1.1.3. setObject

setObject()

Set the object used by the hydrator In this case the “object” is a collection of objects

Parameters:array|Traversable
Return type:Fieldset|FieldsetInterface
Throws :ExceptionInvalidArgumentException

422.1.1.4. populateValues

populateValues()

Populate values

Parameters:array|Traversable
Throws ZendFormExceptionInvalidArgumentException:
 
Throws ZendFormExceptionDomainException:
 
Return type:void

422.1.1.5. allowValueBinding

allowValueBinding()

Checks if this fieldset can bind data

Return type:bool

422.1.1.6. bindValues

bindValues()

Bind values to the object

Parameters:array
Return type:array|mixed|void

422.1.1.7. setCount

setCount()

Set the initial count of target element

Parameters:$count
Return type:Collection

422.1.1.8. getCount

getCount()

Get the initial count of target element

Return type:int

422.1.1.9. setTargetElement

setTargetElement()

Set the target element

Parameters:ElementInterface|array|Traversable
Return type:Collection
Throws :ZendFormExceptionInvalidArgumentException

422.1.1.10. getTargetElement

getTargetElement()

Get target element

Return type:ElementInterface|null

422.1.1.11. setAllowAdd

setAllowAdd()

Get allow add

Parameters:bool
Return type:Collection

422.1.1.12. allowAdd

allowAdd()

Get allow add

Return type:bool

422.1.1.13. setAllowRemove

setAllowRemove()

@param bool $allowRemove

Return type:Collection

422.1.1.14. allowRemove

allowRemove()

@return bool

422.1.1.15. setShouldCreateTemplate

setShouldCreateTemplate()

If set to true, a template prototype is automatically added to the form to ease the creation of dynamic elements through JavaScript

Parameters:bool
Return type:Collection

422.1.1.16. shouldCreateTemplate

shouldCreateTemplate()

Get if the collection should create a template

Return type:bool

422.1.1.17. setTemplatePlaceholder

setTemplatePlaceholder()

Set the placeholder used in the template generated to help create new elements in JavaScript

Parameters:string
Return type:Collection

422.1.1.18. getTemplatePlaceholder

getTemplatePlaceholder()

Get the template placeholder

Return type:string

422.1.1.19. getTemplateElement

getTemplateElement()

Get a template element used for rendering purposes only

Return type:null|ElementInterface|FieldsetInterface

422.1.1.20. prepareElement

prepareElement()

Prepare the collection by adding a dummy template element if the user want one

Parameters:FormInterface
Return type:mixed|void

422.1.1.21. extract

extract()

@return array

422.1.1.22. prepareFieldset

prepareFieldset()

If both count and targetElement are set, add them to the fieldset

Return type:void

422.1.1.23. createNewTargetElementInstance

createNewTargetElementInstance()

Create a new instance of the target element

Return type:ElementInterface

422.1.1.24. createTemplateElement

createTemplateElement()

Create a dummy template element

Return type:null|ElementInterface|FieldsetInterface

422.1.2. Constants

422.1.2.1. DEFAULT_TEMPLATE_PLACEHOLDER

Default template placeholder