Class CExistValidator
CExistValidator validates that the attribute value exists in a table.
This validator is often used to verify that a foreign key contains a value that can be found in the foreign table.
When using theCValidator::$message
property to define a custom error message, the
message may contain additional placeholders that will be replaced with the
actual content. In addition to the "{attribute}" placeholder, recognized by all
validators (see CValidator
), CExistValidator allows for the following
placeholders to be specified:
- {value}: replaced with value of the attribute.
- CComponent
- CValidator
- CExistValidator
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Located at x2engine/framework/validators/CExistValidator.php
protected
|
#
validateAttribute(
Validates the attribute of the object. If there is any error, the error message is added to the object. |
protected
|
addError(),
applyTo(),
clientValidateAttribute(),
createValidator(),
isEmpty(),
validate()
|
public
boolean
|
$caseSensitive | true |
#
whether the comparison is case sensitive. Defaults to true. Note, by setting it to false, you are assuming the attribute type is string. |
public
string
|
$className |
|
#
the ActiveRecord class name that should be used to look for the attribute value being validated. Defaults to null, meaning using the ActiveRecord class of the attribute being validated. You may use path alias to reference a class name here. |
public
string
|
$attributeName |
|
#
the ActiveRecord class attribute name that should be used to look for the attribute value being validated. Defaults to null, meaning using the name of the attribute being validated. |
public
mixed
|
$criteria | array() |
#
additional query criteria. Either an array or CDbCriteria. This will be
combined with the condition that checks if the attribute value exists in the
corresponding table column. This array will be used to instantiate a |
public
boolean
|
$allowEmpty | true |
#
whether the attribute value can be null or empty. Defaults to true, meaning that if the attribute is empty, it is considered valid. |
$attributes,
$builtInValidators,
$enableClientValidation,
$except,
$message,
$on,
$safe,
$skipOnError
|