Abstract Class ActiveRecord_Validation

Description

ActiveRecord_Validation is an interface for objects that can perform validations on an ActiveRecord instance. One instance of an ActiveRecord_Validation may have validate invoked for multiple ActiveRecord instances.

  • abstract:

Located in /activerecord/lib/ActiveRecord/Validation.php (line 18)


	
			
Direct descendents
Class Description
 class ActiveRecord_Association_BelongsToKeyValidation A validation for the foreign key field on a belongs_to relationship
 class ActiveRecord_ConfirmationValidation A validation to check that a confirmation attribute for an
 class ActiveRecord_PresentValidation A validation to check that an attribute is non-empty (as determined by the PHP function empty()).
 class ActiveRecord_BoundsValidation A validation to check that an attribute's string length is within a certain range.
 class ActiveRecord_UniqueValidation A validation to check that an attribute's value is unique.
 class ActiveRecord_RegExValidation A validation to check that an attribute's value conforms to a regular expression.
 class ActiveRecord_SetValidation A validation to check that an attribute's value is contained in a specified list.
 class ActiveRecord_NumericValidation A validation to check that an attribute's value is numeric.
Class Constant Summary
Variable Summary
 mixed $condition
 mixed $type
Method Summary
 ActiveRecord_Validation __construct ([int $type = ActiveRecord_Validation::ON_SAVE], [string $condition = false])
Variables
mixed $condition (line 41)

Optional condition method for determining whether or not to run

the validation

  • access: protected
mixed $type (line 35)

Validation type. One of ON_SAVE, ON_CREATE, or ON_UPDATE.

  • access: public
Methods
Constructor __construct (line 49)

Constructor

  • access: public
ActiveRecord_Validation __construct ([int $type = ActiveRecord_Validation::ON_SAVE], [string $condition = false])
  • int $type: The validation type (ON_SAVE, ON_CREATE, or ON_UPDATE)
  • string $condition: Optional method to call for determining whether to run the validation or not

Redefined in descendants as:
should_validate (line 71)

Determine if the object should be validated or not based on the configured condition

  • access: public
bool should_validate (ActiveRecord_Base $obj)
validate (line 61)

Validate the object provided. If the object is invalid, it is the responsibility of this method to add any errors appropriate to the object's error collection.

  • abstract:
  • access: public
void validate (ActiveRecord_Base $obj)

Redefined in descendants as:
Class Constants
ON_CREATE = 2 (line 26)

Type for validations that run only on update

ON_SAVE = 1 (line 22)

Type for validations that always run

ON_UPDATE = 3 (line 30)

Type for validations that always run

Documentation generated on Wed, 25 Apr 2012 09:46:46 -0700 by phpDocumentor 1.4.3