core/xpdo/validation/xpdovalidator.class.php
The base xPDO validation classes.
This file contains the base validation classes used by xPDO.
- Package
- xpdo
- Subpackage
- validation
\xPDOForeignKeyConstraint
The base validation rule class.
- Parent(s)
- \xPDOValidationRule
Properties
$field= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$field
$message= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$message
$name= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$name
$validator= 'null'
null
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$validator
Methods
__construct(
\xPDOValidator $validator, mixed $field, mixed $name, string $message
=
''
)
:
\xPDOValidationRule
Construct a new xPDOValidationRule instance.
Inherited from: \xPDOValidationRule::__construct()Name | Type | Description |
---|---|---|
$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. |
Type | Description |
---|---|
\xPDOValidationRule | The rule instance. |
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.
Name | Type | Description |
---|---|---|
$value | mixed | The value of the field being validated. |
$options | array | Any options expected by the rule. |
Type | Description |
---|---|
boolean | True if the validation rule was passed, otherwise false. |
\xPDOMaxLengthValidationRule
The base validation rule class.
- Parent(s)
- \xPDOValidationRule
Properties
$field= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$field
$message= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$message
$name= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$name
$validator= 'null'
null
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$validator
Methods
__construct(
\xPDOValidator $validator, mixed $field, mixed $name, string $message
=
''
)
:
\xPDOValidationRule
Construct a new xPDOValidationRule instance.
Inherited from: \xPDOValidationRule::__construct()Name | Type | Description |
---|---|---|
$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. |
Type | Description |
---|---|
\xPDOValidationRule | The rule instance. |
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.
Name | Type | Description |
---|---|---|
$value | mixed | The value of the field being validated. |
$options | array | Any options expected by the rule. |
Type | Description |
---|---|
boolean | True if the validation rule was passed, otherwise false. |
\xPDOMaxValueValidationRule
The base validation rule class.
- Parent(s)
- \xPDOValidationRule
Properties
$field= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$field
$message= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$message
$name= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$name
$validator= 'null'
null
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$validator
Methods
__construct(
\xPDOValidator $validator, mixed $field, mixed $name, string $message
=
''
)
:
\xPDOValidationRule
Construct a new xPDOValidationRule instance.
Inherited from: \xPDOValidationRule::__construct()Name | Type | Description |
---|---|---|
$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. |
Type | Description |
---|---|
\xPDOValidationRule | The rule instance. |
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.
Name | Type | Description |
---|---|---|
$value | mixed | The value of the field being validated. |
$options | array | Any options expected by the rule. |
Type | Description |
---|---|
boolean | True if the validation rule was passed, otherwise false. |
\xPDOMinLengthValidationRule
The base validation rule class.
- Parent(s)
- \xPDOValidationRule
Properties
$field= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$field
$message= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$message
$name= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$name
$validator= 'null'
null
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$validator
Methods
__construct(
\xPDOValidator $validator, mixed $field, mixed $name, string $message
=
''
)
:
\xPDOValidationRule
Construct a new xPDOValidationRule instance.
Inherited from: \xPDOValidationRule::__construct()Name | Type | Description |
---|---|---|
$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. |
Type | Description |
---|---|
\xPDOValidationRule | The rule instance. |
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.
Name | Type | Description |
---|---|---|
$value | mixed | The value of the field being validated. |
$options | array | Any options expected by the rule. |
Type | Description |
---|---|
boolean | True if the validation rule was passed, otherwise false. |
\xPDOMinValueValidationRule
The base validation rule class.
- Parent(s)
- \xPDOValidationRule
Properties
$field= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$field
$message= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$message
$name= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$name
$validator= 'null'
null
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$validator
Methods
__construct(
\xPDOValidator $validator, mixed $field, mixed $name, string $message
=
''
)
:
\xPDOValidationRule
Construct a new xPDOValidationRule instance.
Inherited from: \xPDOValidationRule::__construct()Name | Type | Description |
---|---|---|
$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. |
Type | Description |
---|---|
\xPDOValidationRule | The rule instance. |
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.
Name | Type | Description |
---|---|---|
$value | mixed | The value of the field being validated. |
$options | array | Any options expected by the rule. |
Type | Description |
---|---|
boolean | True if the validation rule was passed, otherwise false. |
\xPDOObjectExistsValidationRule
The base validation rule class.
- Parent(s)
- \xPDOValidationRule
Properties
$field= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$field
$message= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$message
$name= ''''
''
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$name
$validator= 'null'
null
Details- Type
- n/a
- Inherited_from
- \xPDOValidationRule::$$validator
Methods
__construct(
\xPDOValidator $validator, mixed $field, mixed $name, string $message
=
''
)
:
\xPDOValidationRule
Construct a new xPDOValidationRule instance.
Inherited from: \xPDOValidationRule::__construct()Name | Type | Description |
---|---|---|
$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. |
Type | Description |
---|---|
\xPDOValidationRule | The rule instance. |
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.
Name | Type | Description |
---|---|---|
$value | mixed | The value of the field being validated. |
$options | array | Any options expected by the rule. |
Type | Description |
---|---|
boolean | True if the validation rule was passed, otherwise false. |
\xPDOValidationRule
The base validation rule class.
- Children
- \xPDOMinLengthValidationRule
- \xPDOMaxLengthValidationRule
- \xPDOMinValueValidationRule
- \xPDOMaxValueValidationRule
- \xPDOObjectExistsValidationRule
- \xPDOForeignKeyConstraint
Properties
Methods
__construct(
\xPDOValidator $validator, mixed $field, mixed $name, string $message
=
''
)
:
\xPDOValidationRule
Construct a new xPDOValidationRule instance.
Name | Type | Description |
---|---|---|
$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. |
Type | Description |
---|---|
\xPDOValidationRule | The rule instance. |
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.
Name | Type | Description |
---|---|---|
$value | mixed | The value of the field being validated. |
$options | array | Any options expected by the rule. |
Type | Description |
---|---|
boolean | True if the validation rule was passed, otherwise false. |
\xPDOValidator
The base validation service class.
Extend this class to customize the validation process.
- Children
- \modValidator
Properties
Methods
addMessage(
string $field, string $name, mixed $message
=
null
)
:
void
Add a validation message to the stack.
Name | Type | Description |
---|---|---|
$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. |
getMessages(
)
:
array
Get the validation messages generated by validate().
Type | Description |
---|---|
array | An array of validation messages. |
getResults(
)
:
array
Get the validation results generated by validate().
Type | Description |
---|---|
array | An array of boolean validation results. |
hasMessages(
)
:
boolean
Indicates validation messages were generated by validate().
Type | Description |
---|---|
boolean | True if messages were generated. |