spunQ_UniqueMemberValidator Class Reference

Assures that a value does not exist in the database. More...

Inheritance diagram for spunQ_UniqueMemberValidator:

spunQ_IFieldValidator

List of all members.

Public Member Functions

 __construct ($typeName=NULL, $memberName=NULL, $caseSensitive=false, $ignoredIds=array())
 Constructor.
 showJsValidationString ($typePath, $messagePrefix)
 Prints javascript for this validator.
 validate ($messagePrefix, $value)
 Does the validation.

Protected Attributes

 $typeName
 The name of the type of which the member must be uniqe.
 $memberName
 The member name which must be unique within the objects of $typeName.
 $caseSensitive
 Whether the comparison should be case-sensitive.
 $ignoredIds
 Ids that can be ignored in the query.


Detailed Description

Assures that a value does not exist in the database.

This is called UniqueMemberValidator since it is mostly used to assure that a value does not exist in the database before inserting a new object, thus assuring the newly inserted value is unique.

Definition at line 9 of file UniqueMemberValidator.class.php.


Constructor & Destructor Documentation

spunQ_UniqueMemberValidator::__construct ( typeName = NULL,
memberName = NULL,
caseSensitive = false,
ignoredIds = array() 
)

Constructor.

Parameters:
$typeName Name of the type the $member belongs to.
$memberName Name of the member that should not exist in the database.
$caseSensitive Whether the comparison should be case-sensitive. Setting this to true will make sure that no two users with two distinct names admin and admiN are registered, for example.
$ignoredIds Array of ignored ids.

Definition at line 48 of file UniqueMemberValidator.class.php.


Member Function Documentation

spunQ_UniqueMemberValidator::showJsValidationString ( typePath,
messagePrefix 
)

Prints javascript for this validator.

Should make use a call to the spunQ javascript function spunQ.form.registerValidator().

Parameters:
$messagePrefix A string to prepend to the error message key.
Returns:
boolean Whether any validation javascript was displayed.

Implements spunQ_IFieldValidator.

Definition at line 63 of file UniqueMemberValidator.class.php.

spunQ_UniqueMemberValidator::validate ( messagePrefix,
value 
)

Does the validation.

Parameters:
$messagePrefix A string to prepend to the error message key.
$value The spunQ value to validate.
Returns:
string Error message for the validated field, or NULL if the value was valid.

Implements spunQ_IFieldValidator.

Definition at line 70 of file UniqueMemberValidator.class.php.


Member Data Documentation

spunQ_UniqueMemberValidator::$caseSensitive [protected]

Whether the comparison should be case-sensitive.

Setting this to true will make sure that no two users with two distinct names admin and admiN are registered, for example.

Type:
boolean

Definition at line 29 of file UniqueMemberValidator.class.php.

spunQ_UniqueMemberValidator::$ignoredIds [protected]

Ids that can be ignored in the query.

This will be needed if a stored object is being updated.

Type:
array<integer>

Definition at line 36 of file UniqueMemberValidator.class.php.

spunQ_UniqueMemberValidator::$memberName [protected]

The member name which must be unique within the objects of $typeName.

Type:
string

Definition at line 21 of file UniqueMemberValidator.class.php.

spunQ_UniqueMemberValidator::$typeName [protected]

The name of the type of which the member must be uniqe.

Type:
string

Definition at line 15 of file UniqueMemberValidator.class.php.


The documentation for this class was generated from the following file:

Generated on Fri Jul 1 11:12:44 2011 for spunQ3 by  doxygen 1.5.9