2018. Class

2018.1. Zend\Validator\ValidatorChain

2018.1.1. Methods

2018.1.1.1. count

count()

Return the count of attached validators

Return type:int

2018.1.1.2. getPluginManager

getPluginManager()

Get plugin manager instance

Return type:ValidatorPluginManager

2018.1.1.3. setPluginManager

setPluginManager()

Set plugin manager instance

Parameters:ValidatorPluginManager – Plugin manager
Return type:ValidatorChain

2018.1.1.4. plugin

plugin()

Retrieve a validator by name

Parameters:
  • string – Name of validator to return
  • null|array – Options to pass to validator constructor (if not already instantiated)
Return type:

ValidatorInterface

2018.1.1.5. attach

attach()

Attach a validator to the end of the chain

If $breakChainOnFailure is true, then if the validator fails, the next validator in the chain, if one exists, will not be executed.

Parameters:
  • ValidatorInterface
  • bool
Return type:

ValidatorChain Provides a fluent interface

2018.1.1.6. addValidator

addValidator()

Proxy to attach() to keep BC

Parameters:
  • ValidatorInterface
  • boolean
Return type:

ValidatorChain Provides a fluent interface

2018.1.1.7. prependValidator

prependValidator()

Adds a validator to the beginning of the chain

If $breakChainOnFailure is true, then if the validator fails, the next validator in the chain, if one exists, will not be executed.

Parameters:
  • ValidatorInterface
  • bool
Return type:

ValidatorChain Provides a fluent interface

2018.1.1.8. attachByName

attachByName()

Use the plugin manager to add a validator by name

Parameters:
  • string
  • array
  • bool
Return type:

ValidatorChain

2018.1.1.9. addByName

addByName()

Proxy to attachByName() to keep BC

Parameters:
  • string
  • array
  • bool
Return type:

ValidatorChain

2018.1.1.10. prependByName

prependByName()

Use the plugin manager to prepend a validator by name

Parameters:
  • string
  • array
  • bool
Return type:

ValidatorChain

2018.1.1.11. isValid

isValid()

Returns true if and only if $value passes all validations in the chain

Validators are run in the order in which they were added to the chain (FIFO).

Parameters:
  • mixed
  • mixed – Extra “context” to provide the validator
Return type:

bool

2018.1.1.12. merge

merge()

Merge the validator chain with the one given in parameter

Parameters:ValidatorChain
Return type:ValidatorChain

2018.1.1.13. getMessages

getMessages()

Returns array of validation failure messages

Return type:array

2018.1.1.14. getValidators

getValidators()

Get all the validators

Return type:array

2018.1.1.15. __invoke

__invoke()

Invoke chain as command

Parameters:mixed
Return type:bool

2018.1.1.16. __sleep

__sleep()

Prepare validator chain for serialization

Plugin manager (property ‘plugins’) cannot be serialized. On wakeup the property remains unset and next invokation to getPluginManager() sets the default plugin manager instance (ValidatorPluginManager).

Return type:array