Class ActiveRecord_UniqueValidation

Description

A validation to check that an attribute's value is unique.

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

ActiveRecord_Validation
   |
   --ActiveRecord_UniqueValidation
Variable Summary
 mixed $allowNull
 mixed $attrNames
 mixed $for_class
 mixed $msg
 mixed $scope
Method Summary
 ActiveRecord_UniqueValidation __construct (array $attrNames, [bool $caseInsensitive = false], [array $scope = false], [string $msg = false], [bool $allowNull = false], [int $type = ActiveRecord_Validation::ON_SAVE], [string $condition = false], [string $forClass = null])
Variables
mixed $allowNull (line 265)

Flag indicating whether nulls are allowed

  • access: protected
mixed $attrNames (line 253)

List of attribute names to validate

  • access: protected
mixed $caseInsenstive (line 261)

Flag indicating case sensitivity

  • access: protected
mixed $for_class (line 273)

Declaring class

  • access: protected
mixed $msg (line 257)

Error message to use

  • access: protected
mixed $scope (line 269)

Scoping conditions

  • access: protected

Inherited Variables

Inherited from ActiveRecord_Validation

ActiveRecord_Validation::$condition
ActiveRecord_Validation::$type
Methods
Constructor __construct (line 287)

Constructor

  • access: public
ActiveRecord_UniqueValidation __construct (array $attrNames, [bool $caseInsensitive = false], [array $scope = false], [string $msg = false], [bool $allowNull = false], [int $type = ActiveRecord_Validation::ON_SAVE], [string $condition = false], [string $forClass = null])
  • array $attrNames: An array of attribute names to validate
  • bool $caseInsensitive: If true, case insensitivy is forced (otherwise DB dependent)
  • array $scope: An array of attribute names to use for scoping conditions
  • string $msg: Error message to use
  • bool $allowNull: If true and the value is null, validation is skipped
  • 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
  • string $forClass: Optional class name to operate on (defaults to whatever record type it is given to validate)

Redefinition of:
ActiveRecord_Validation::__construct()
Constructor
validate (line 305)

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.

  • access: public
void validate (ActiveRecord_Base $obj)

Redefinition of:
ActiveRecord_Validation::validate()
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.

Inherited Methods

Inherited From ActiveRecord_Validation

 ActiveRecord_Validation::__construct()
 ActiveRecord_Validation::should_validate()
 ActiveRecord_Validation::validate()
Class Constants

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