core/xpdo/validation/xpdovalidator.class.php

Show: inherited
Table of Contents

The base xPDO validation classes.

This file contains the base validation classes used by xPDO.

Package
xpdo  
Subpackage
validation  

\xPDOForeignKeyConstraint

Package:

The base validation rule class.

Parent(s)
\xPDOValidationRule

Properties

Propertypublic  $field= ''''
inheritedInherited from: \xPDOValidationRule::$$field
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$field  
Propertypublic  $message= ''''
inheritedInherited from: \xPDOValidationRule::$$message
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$message  
Propertypublic  $name= ''''
inheritedInherited from: \xPDOValidationRule::$$name
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$name  
Propertypublic  $validator= 'null'
inheritedInherited from: \xPDOValidationRule::$$validator
Default valuenullDetails
Type
n/a
Inherited_from
\xPDOValidationRule::$$validator  

Methods

methodpublic__construct( \xPDOValidator $validator, mixed $field, mixed $name, string $message = '' ) : \xPDOValidationRule
inherited

Construct a new xPDOValidationRule instance.

Inherited from: \xPDOValidationRule::__construct()
Parameters
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.

Returns
Type Description
\xPDOValidationRule The rule instance.
methodpublicisValid( 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.

Parameters
Name Type Description
$value mixed

The value of the field being validated.

$options array

Any options expected by the rule.

Returns
Type Description
boolean True if the validation rule was passed, otherwise false.
methodpublicsetMessage( string $message = '' ) : void
inherited

Set the failure message for the rule.

Inherited from: \xPDOValidationRule::setMessage()
Parameters
Name Type Description
$message string

A message intended to convey the reason for rule failure.

\xPDOMaxLengthValidationRule

Package:

The base validation rule class.

Parent(s)
\xPDOValidationRule

Properties

Propertypublic  $field= ''''
inheritedInherited from: \xPDOValidationRule::$$field
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$field  
Propertypublic  $message= ''''
inheritedInherited from: \xPDOValidationRule::$$message
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$message  
Propertypublic  $name= ''''
inheritedInherited from: \xPDOValidationRule::$$name
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$name  
Propertypublic  $validator= 'null'
inheritedInherited from: \xPDOValidationRule::$$validator
Default valuenullDetails
Type
n/a
Inherited_from
\xPDOValidationRule::$$validator  

Methods

methodpublic__construct( \xPDOValidator $validator, mixed $field, mixed $name, string $message = '' ) : \xPDOValidationRule
inherited

Construct a new xPDOValidationRule instance.

Inherited from: \xPDOValidationRule::__construct()
Parameters
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.

Returns
Type Description
\xPDOValidationRule The rule instance.
methodpublicisValid( 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.

Parameters
Name Type Description
$value mixed

The value of the field being validated.

$options array

Any options expected by the rule.

Returns
Type Description
boolean True if the validation rule was passed, otherwise false.
methodpublicsetMessage( string $message = '' ) : void
inherited

Set the failure message for the rule.

Inherited from: \xPDOValidationRule::setMessage()
Parameters
Name Type Description
$message string

A message intended to convey the reason for rule failure.

\xPDOMaxValueValidationRule

Package:

The base validation rule class.

Parent(s)
\xPDOValidationRule

Properties

Propertypublic  $field= ''''
inheritedInherited from: \xPDOValidationRule::$$field
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$field  
Propertypublic  $message= ''''
inheritedInherited from: \xPDOValidationRule::$$message
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$message  
Propertypublic  $name= ''''
inheritedInherited from: \xPDOValidationRule::$$name
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$name  
Propertypublic  $validator= 'null'
inheritedInherited from: \xPDOValidationRule::$$validator
Default valuenullDetails
Type
n/a
Inherited_from
\xPDOValidationRule::$$validator  

Methods

methodpublic__construct( \xPDOValidator $validator, mixed $field, mixed $name, string $message = '' ) : \xPDOValidationRule
inherited

Construct a new xPDOValidationRule instance.

Inherited from: \xPDOValidationRule::__construct()
Parameters
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.

Returns
Type Description
\xPDOValidationRule The rule instance.
methodpublicisValid( 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.

Parameters
Name Type Description
$value mixed

The value of the field being validated.

$options array

Any options expected by the rule.

Returns
Type Description
boolean True if the validation rule was passed, otherwise false.
methodpublicsetMessage( string $message = '' ) : void
inherited

Set the failure message for the rule.

Inherited from: \xPDOValidationRule::setMessage()
Parameters
Name Type Description
$message string

A message intended to convey the reason for rule failure.

\xPDOMinLengthValidationRule

Package:

The base validation rule class.

Parent(s)
\xPDOValidationRule

Properties

Propertypublic  $field= ''''
inheritedInherited from: \xPDOValidationRule::$$field
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$field  
Propertypublic  $message= ''''
inheritedInherited from: \xPDOValidationRule::$$message
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$message  
Propertypublic  $name= ''''
inheritedInherited from: \xPDOValidationRule::$$name
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$name  
Propertypublic  $validator= 'null'
inheritedInherited from: \xPDOValidationRule::$$validator
Default valuenullDetails
Type
n/a
Inherited_from
\xPDOValidationRule::$$validator  

Methods

methodpublic__construct( \xPDOValidator $validator, mixed $field, mixed $name, string $message = '' ) : \xPDOValidationRule
inherited

Construct a new xPDOValidationRule instance.

Inherited from: \xPDOValidationRule::__construct()
Parameters
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.

Returns
Type Description
\xPDOValidationRule The rule instance.
methodpublicisValid( 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.

Parameters
Name Type Description
$value mixed

The value of the field being validated.

$options array

Any options expected by the rule.

Returns
Type Description
boolean True if the validation rule was passed, otherwise false.
methodpublicsetMessage( string $message = '' ) : void
inherited

Set the failure message for the rule.

Inherited from: \xPDOValidationRule::setMessage()
Parameters
Name Type Description
$message string

A message intended to convey the reason for rule failure.

\xPDOMinValueValidationRule

Package:

The base validation rule class.

Parent(s)
\xPDOValidationRule

Properties

Propertypublic  $field= ''''
inheritedInherited from: \xPDOValidationRule::$$field
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$field  
Propertypublic  $message= ''''
inheritedInherited from: \xPDOValidationRule::$$message
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$message  
Propertypublic  $name= ''''
inheritedInherited from: \xPDOValidationRule::$$name
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$name  
Propertypublic  $validator= 'null'
inheritedInherited from: \xPDOValidationRule::$$validator
Default valuenullDetails
Type
n/a
Inherited_from
\xPDOValidationRule::$$validator  

Methods

methodpublic__construct( \xPDOValidator $validator, mixed $field, mixed $name, string $message = '' ) : \xPDOValidationRule
inherited

Construct a new xPDOValidationRule instance.

Inherited from: \xPDOValidationRule::__construct()
Parameters
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.

Returns
Type Description
\xPDOValidationRule The rule instance.
methodpublicisValid( 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.

Parameters
Name Type Description
$value mixed

The value of the field being validated.

$options array

Any options expected by the rule.

Returns
Type Description
boolean True if the validation rule was passed, otherwise false.
methodpublicsetMessage( string $message = '' ) : void
inherited

Set the failure message for the rule.

Inherited from: \xPDOValidationRule::setMessage()
Parameters
Name Type Description
$message string

A message intended to convey the reason for rule failure.

\xPDOObjectExistsValidationRule

Package:

The base validation rule class.

Parent(s)
\xPDOValidationRule

Properties

Propertypublic  $field= ''''
inheritedInherited from: \xPDOValidationRule::$$field
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$field  
Propertypublic  $message= ''''
inheritedInherited from: \xPDOValidationRule::$$message
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$message  
Propertypublic  $name= ''''
inheritedInherited from: \xPDOValidationRule::$$name
Default value''Details
Type
n/a
Inherited_from
\xPDOValidationRule::$$name  
Propertypublic  $validator= 'null'
inheritedInherited from: \xPDOValidationRule::$$validator
Default valuenullDetails
Type
n/a
Inherited_from
\xPDOValidationRule::$$validator  

Methods

methodpublic__construct( \xPDOValidator $validator, mixed $field, mixed $name, string $message = '' ) : \xPDOValidationRule
inherited

Construct a new xPDOValidationRule instance.

Inherited from: \xPDOValidationRule::__construct()
Parameters
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.

Returns
Type Description
\xPDOValidationRule The rule instance.
methodpublicisValid( 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.

Parameters
Name Type Description
$value mixed

The value of the field being validated.

$options array

Any options expected by the rule.

Returns
Type Description
boolean True if the validation rule was passed, otherwise false.
methodpublicsetMessage( string $message = '' ) : void
inherited

Set the failure message for the rule.

Inherited from: \xPDOValidationRule::setMessage()
Parameters
Name Type Description
$message string

A message intended to convey the reason for rule failure.

\xPDOValidationRule

Package: xpdo\validation

The base validation rule class.

Children
\xPDOMinLengthValidationRule
\xPDOMaxLengthValidationRule
\xPDOMinValueValidationRule
\xPDOMaxValueValidationRule
\xPDOObjectExistsValidationRule
\xPDOForeignKeyConstraint

Properties

Propertypublic  $field= ''''
Default value''Details
Type
n/a
Propertypublic  $message= ''''
Default value''Details
Type
n/a
Propertypublic  $name= ''''
Default value''Details
Type
n/a
Propertypublic  $validator= 'null'
Default valuenullDetails
Type
n/a

Methods

methodpublic__construct( \xPDOValidator $validator, mixed $field, mixed $name, string $message = '' ) : \xPDOValidationRule

Construct a new xPDOValidationRule instance.

Parameters
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.

Returns
Type Description
\xPDOValidationRule The rule instance.
methodpublicisValid( 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.

Parameters
Name Type Description
$value mixed

The value of the field being validated.

$options array

Any options expected by the rule.

Returns
Type Description
boolean True if the validation rule was passed, otherwise false.
methodpublicsetMessage( string $message = '' ) : void

Set the failure message for the rule.

Parameters
Name Type Description
$message string

A message intended to convey the reason for rule failure.

\xPDOValidator

Package: xpdo\validation

The base validation service class.

Extend this class to customize the validation process.

Children
\modValidator

Properties

Propertypublic  $messages= 'array()'
Default valuearray()Details
Type
n/a
Propertypublic  $object= 'null'
Default valuenullDetails
Type
n/a
Propertypublic  $results= 'array()'
Default valuearray()Details
Type
n/a

Methods

methodpublic__construct(  $object ) : void

Parameters
Name Type Description
$object
methodpublicaddMessage( string $field, string $name, mixed $message = null ) : void

Add a validation message to the stack.

Parameters
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.

methodpublicgetMessages( ) : array

Get the validation messages generated by validate().

Returns
Type Description
array An array of validation messages.
methodpublicgetResults( ) : array

Get the validation results generated by validate().

Returns
Type Description
array An array of boolean validation results.
methodpublichasMessages( ) : boolean

Indicates validation messages were generated by validate().

Returns
Type Description
boolean True if messages were generated.
methodpublicreset( ) : void

Reset the validation results and messages.

methodpublicvalidate( array $parameters = array() ) : boolean

Executes validation against the object attached to this validator.

Parameters
Name Type Description
$parameters array

A collection of parameters.

Returns
Type Description
boolean Either true or false indicating valid or invalid.
Documentation was generated by DocBlox 0.18.1.