DBFieldSet Class Reference
[Model]
A SET datatype as supported by MySQL. More...
Public Member Functions |
|
convert_result ($value) | |
Transform result from SELECT to native.
|
|
format_select () | |
Allow replacements for field in select from
clause. |
|
validate ($value) | |
Returns true, if the value passed fits the
fields restrictions. |
|
Static Public Member Functions |
|
static | set_clear_value (&$set, $value) |
Clear value on given set. |
|
static | set_has_value ($set, $value) |
Returns wether value is in given set or not.
|
|
static | set_set_value (&$set, $value) |
Set value on given set. |
|
Protected Member Functions |
|
do_format_not_null ($value) | |
Format values that are not NULL. |
Detailed Description
A SET datatype as supported by MySQL.
Actually a couple of bit flags
The SET datatype is an array that is saved into DB as integer
Definition at line 12 of file dbfield.set.cls.php.
Member Function Documentation
DBFieldSet::convert_result | ( | $ | value | ) |
Transform result from SELECT to native.
- Parameters:
-
mixed $value
- Returns:
- mixed
Reimplemented from DBField.
Definition at line 62 of file dbfield.set.cls.php.
DBFieldSet::do_format_not_null | ( | $ | value | ) | [protected] |
Format values that are not NULL.
- Parameters:
-
mixed $value
- Returns:
- string
Reimplemented from DBField.
Definition at line 36 of file dbfield.set.cls.php.
00036 { 00037 $value = Arr::force($value); 00038 $ret = 0; 00039 $cnt = count($this->allowed); 00040 for ($i = 0; $i < $cnt; $i++) { 00041 $test = $this->allowed[$i]; 00042 if (in_array($test, $value)) { 00043 $ret = $ret | pow(2, $i); 00044 } 00045 } 00046 return $ret; 00047 }
DBFieldSet::format_select | ( | ) |
Allow replacements for field in select from clause.
Reimplemented from DBField.
Definition at line 52 of file dbfield.set.cls.php.
00052 { 00053 return $this->get_field_name() . '+0'; 00054 }
static DBFieldSet::set_clear_value | ( | &$ | set, | |
$ | value | |||
) | [static] |
Clear value on given set.
- Parameters:
-
array $set The set to modify string $value The value to set
Definition at line 97 of file dbfield.set.cls.php.
static DBFieldSet::set_has_value | ( | $ | set, | |
$ | value | |||
) | [static] |
Returns wether value is in given set or not.
- Parameters:
-
array $set The set to modify string $value The value to set
- Returns:
- bool
Definition at line 115 of file dbfield.set.cls.php.
static DBFieldSet::set_set_value | ( | &$ | set, | |
$ | value | |||
) | [static] |
Set value on given set.
- Parameters:
-
array $set The set to modify string $value The value to set
Definition at line 84 of file dbfield.set.cls.php.
DBFieldSet::validate | ( | $ | value | ) |
Returns true, if the value passed fits the fields restrictions.
- Parameters:
-
mixed $value
- Returns:
- Status
Reimplemented from DBFieldEnum.
Definition at line 19 of file dbfield.set.cls.php.
00019 { 00020 $ret = new Status(); 00021 $arr_value = Arr::force($value, false); 00022 foreach($arr_value as $val) { 00023 // if ($val !== '') { 00024 $ret->merge(parent::validate($val)); 00025 // } 00026 } 00027 return $ret; 00028 }
The documentation for this class was generated from the following file:
- gyro/core/model/base/fields/dbfield.set.cls.php