xpdo/validation/xpdovalidator.class.php
- package
- xpdo
- subpackage
- validation
- Classes
- xPDOValidator
- xPDOValidationRule
- xPDOMinLengthValidationRule
- xPDOMaxLengthValidationRule
- xPDOMinValueValidationRule
- xPDOMaxValueValidationRule
- xPDOObjectExistsValidationRule
- xPDOForeignKeyConstraint
Description
The base xPDO validation classes.
This file contains the base validation classes used by xPDO.
\xPDOForeignKeyConstraint
- Extends from
- \xPDOValidationRule
- package
- xpdo
- Methods
- isValid
Description
The base validation rule class.
Methods
isValid
isValid(
mixed $value, array $options
=
array
)
:
boolean
The public method for executing a validation rule.
Extend this method to provide a reusable validation rule in your xPDOValidator instance.
Arguments
- $value
- mixed
The value of the field being validated. - $options
- array
Any options expected by the rule.
Output
- boolean
- True if the validation rule was passed, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
\xPDOMaxLengthValidationRule
- Extends from
- \xPDOValidationRule
- package
- xpdo
- Methods
- isValid
Description
The base validation rule class.
Methods
isValid
isValid(
mixed $value, array $options
=
array
)
:
boolean
The public method for executing a validation rule.
Extend this method to provide a reusable validation rule in your xPDOValidator instance.
Arguments
- $value
- mixed
The value of the field being validated. - $options
- array
Any options expected by the rule.
Output
- boolean
- True if the validation rule was passed, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
\xPDOMaxValueValidationRule
- Extends from
- \xPDOValidationRule
- package
- xpdo
- Methods
- isValid
Description
The base validation rule class.
Methods
isValid
isValid(
mixed $value, array $options
=
array
)
:
boolean
The public method for executing a validation rule.
Extend this method to provide a reusable validation rule in your xPDOValidator instance.
Arguments
- $value
- mixed
The value of the field being validated. - $options
- array
Any options expected by the rule.
Output
- boolean
- True if the validation rule was passed, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
\xPDOMinLengthValidationRule
- Extends from
- \xPDOValidationRule
- package
- xpdo
- Methods
- isValid
Description
The base validation rule class.
Methods
isValid
isValid(
mixed $value, array $options
=
array
)
:
boolean
The public method for executing a validation rule.
Extend this method to provide a reusable validation rule in your xPDOValidator instance.
Arguments
- $value
- mixed
The value of the field being validated. - $options
- array
Any options expected by the rule.
Output
- boolean
- True if the validation rule was passed, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
\xPDOMinValueValidationRule
- Extends from
- \xPDOValidationRule
- package
- xpdo
- Methods
- isValid
Description
The base validation rule class.
Methods
isValid
isValid(
mixed $value, array $options
=
array
)
:
boolean
The public method for executing a validation rule.
Extend this method to provide a reusable validation rule in your xPDOValidator instance.
Arguments
- $value
- mixed
The value of the field being validated. - $options
- array
Any options expected by the rule.
Output
- boolean
- True if the validation rule was passed, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
\xPDOObjectExistsValidationRule
- Extends from
- \xPDOValidationRule
- package
- xpdo
- Methods
- isValid
Description
The base validation rule class.
Methods
isValid
isValid(
mixed $value, array $options
=
array
)
:
boolean
The public method for executing a validation rule.
Extend this method to provide a reusable validation rule in your xPDOValidator instance.
Arguments
- $value
- mixed
The value of the field being validated. - $options
- array
Any options expected by the rule.
Output
- boolean
- True if the validation rule was passed, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
\xPDOValidationRule
- package
- xpdo
- subpackage
- validation
- Properties
- $field
- $message
- $name
- $validator
- Methods
- __construct
- isValid
- setMessage
Description
The base validation rule class.
Properties
$field
$field = ''
Details
- visibility
- public
- default
- final
- false
- static
- false
$message
$message = ''
Details
- visibility
- public
- default
- final
- false
- static
- false
$name
$name = ''
Details
- visibility
- public
- default
- final
- false
- static
- false
$validator
$validator = 'null'
Details
- visibility
- public
- default
- null
- final
- false
- static
- false
Methods
__construct
__construct(
\xPDOValidator $validator, mixed $field, mixed $name, string $message
)
:
\xPDOValidationRule
Construct a new xPDOValidationRule instance.
Arguments
- $validator
- \xPDOValidator
&$validator A reference to the xPDOValidator executing this rule. - $field
- mixed
The field being validated. - $name
- mixed
The identifying name of the validation rule. - $message
- string
An optional message for rule failure.
Output
- \xPDOValidationRule
- The rule instance.
Details
- visibility
- public
- final
- false
- static
- false
isValid
isValid(
mixed $value, array $options
=
array
)
:
boolean
The public method for executing a validation rule.
Extend this method to provide a reusable validation rule in your xPDOValidator instance.
Arguments
- $value
- mixed
The value of the field being validated. - $options
- array
Any options expected by the rule.
Output
- boolean
- True if the validation rule was passed, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
setMessage
setMessage(
string $message
)
:
Set the failure message for the rule.
Arguments
- $message
- string
A message intended to convey the reason for rule failure.
Details
- visibility
- public
- final
- false
- static
- false
\xPDOValidator
- package
- xpdo
- subpackage
- validation
- Properties
- $messages
- $object
- $results
- Methods
- __construct
- addMessage
- getMessages
- getResults
- hasMessages
- reset
- validate
Description
The base validation service class.
Extend this class to customize the validation process.
Properties
$messages
$messages = 'array'
Details
- visibility
- public
- default
- array
- final
- false
- static
- false
$object
$object = 'null'
Details
- visibility
- public
- default
- null
- final
- false
- static
- false
$results
$results = 'array'
Details
- visibility
- public
- default
- array
- final
- false
- static
- false
Methods
__construct
__construct(
$object
)
:
Arguments
- $object
Details
- visibility
- public
- final
- false
- static
- false
addMessage
addMessage(
string $field, string $name, mixed $message
=
null
)
:
Add a validation message to the stack.
Arguments
- $field
- string
The name of the field the message relates to. - $name
- string
The name of the rule the message relates to. - $message
- mixed
An optional message; the name of the rule is used if no message is specified.
Details
- visibility
- public
- final
- false
- static
- false
getMessages
getMessages(
)
:
array
Get the validation messages generated by validate().
Output
- array
- An array of validation messages.
Details
- visibility
- public
- final
- false
- static
- false
getResults
getResults(
)
:
array
Get the validation results generated by validate().
Output
- array
- An array of boolean validation results.
Details
- visibility
- public
- final
- false
- static
- false
hasMessages
hasMessages(
)
:
boolean
Indicates validation messages were generated by validate().
Output
- boolean
- True if messages were generated.
Details
- visibility
- public
- final
- false
- static
- false
reset
reset(
)
:
Reset the validation results and messages.
Details
- visibility
- public
- final
- false
- static
- false
validate
validate(
array $parameters
=
array
)
:
boolean
Executes validation against the object attached to this validator.
Arguments
- $parameters
- array
A collection of parameters.
Output
- boolean
- Either true or false indicating valid or invalid.
Details
- visibility
- public
- final
- false
- static
- false