framework/utils/CPropertyValue.php
public static function ensureEnum($value,$enumType)
	{
		static $types=array();
		if(!isset($types[$enumType]))
			$types[$enumType]=new ReflectionClass($enumType);
		if($types[$enumType]->hasConstant($value))
			return $value;
		else
			throw new CException(Yii::t('yii','Invalid enumerable value "{value}". Please make sure it is among ({enum}).',
				array('{value}'=>$value, '{enum}'=>implode(', ',$types[$enumType]->getConstants()))));
	}
public static function ensureEnum($value,$enumType)
	{
		static $types=array();
		if(!isset($types[$enumType]))
			$types[$enumType]=new ReflectionClass($enumType);
		if($types[$enumType]->hasConstant($value))
			return $value;
		else
			throw new CException(Yii::t('yii','Invalid enumerable value "{value}". Please make sure it is among ({enum}).',
				array('{value}'=>$value, '{enum}'=>implode(', ',$types[$enumType]->getConstants()))));
	}
public static function ensureEnum ( $ value , $ enumType ) { static $ types = array ( ) ; if ( ! isset ( $ types [ $ enumType ] ) ) $ types [ $ enumType ] = new ReflectionClass ( $ enumType ) ; if ( $ types [ $ enumType ] -> hasConstant ( $ value ) ) return $ value ; else throw new CException ( Yii :: t ( 'yii' , 'Invalid enumerable value "{value}". Please make sure it is among ({enum}).' , array ( '{value}' => $ value , '{enum}' => implode ( ', ' , $ types [ $ enumType ] -> getConstants ( ) ) ) ) ) ; }
Converts a value to enum type.

This method checks if the value is of the specified enumerable type.
A value is a valid enumerable value if it is equal to the name of a constant
in the specified enumerable type (class).
For more details about enumerable, see {@link CEnumerable}.

@param string $value the enumerable value to be checked.
@param string $enumType the enumerable class name (make sure it is included before calling this function).
@return string the valid enumeration value
@throws CException if the value is not a valid enumerable value
Converts a value to enum type .