Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CBooleanValidator
  • CCaptchaValidator
  • CCompareValidator
  • CDateValidator
  • CDefaultValueValidator
  • CEmailValidator
  • CExistValidator
  • CFileValidator
  • CFilterValidator
  • CInlineValidator
  • CNumberValidator
  • CRangeValidator
  • CRegularExpressionValidator
  • CRequiredValidator
  • CSafeValidator
  • CStringValidator
  • CTypeValidator
  • CUniqueValidator
  • CUnsafeValidator
  • CUrlValidator
  • CValidator
  • X2UrlValidator
  • Overview
  • Package
  • Class
  • Tree

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 the CValidator::$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
Extended by CValidator
Extended by CExistValidator
Package: system\validators
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
Methods summary
protected
# validateAttribute( CModel $object, string $attribute )

Validates the attribute of the object. If there is any error, the error message is added to the object.

Validates the attribute of the object. If there is any error, the error message is added to the object.

Parameters

$object
CModel
$object the object being validated
$attribute
string
$attribute the attribute being validated

Throws

CException
if given table does not have specified column name
protected CActiveRecord
# getModel( string $className )

Given active record class name returns new model instance.

Given active record class name returns new model instance.

Parameters

$className
string
$className active record class name.

Returns

CActiveRecord
active record model instance.

Since

1.1.14
Methods inherited from CValidator
addError(), applyTo(), clientValidateAttribute(), createValidator(), isEmpty(), validate()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
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.

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.

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.

See

CExistValidator::$attributeName
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.

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.

See

CExistValidator::$className
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 CDbCriteria object.

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 CDbCriteria object.

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.

whether the attribute value can be null or empty. Defaults to true, meaning that if the attribute is empty, it is considered valid.

Properties inherited from CValidator
$attributes, $builtInValidators, $enableClientValidation, $except, $message, $on, $safe, $skipOnError
API documentation generated by ApiGen 2.8.0