mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE: Added Lower and Upper methods to Varchar, Text, and Enum
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@91048 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
601430653a
commit
c9a6d3a1b0
@ -74,6 +74,13 @@ class Enum extends DBField {
|
||||
function enumValues($hasEmpty = false) {
|
||||
return ($hasEmpty) ? array_merge(array('' => ''), ArrayLib::valuekey($this->enum)) : ArrayLib::valuekey($this->enum);
|
||||
}
|
||||
|
||||
function Lower() {
|
||||
return StringField::Lower();
|
||||
}
|
||||
function Upper() {
|
||||
return StringField::Upper();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -76,4 +76,19 @@ abstract class StringField extends DBField {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return another DBField object with this value in lowercase.
|
||||
*/
|
||||
function Lower() {
|
||||
return DBField::create(get_class($this), strtolower($this->value), $this->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return another DBField object with this value in uppercase.
|
||||
*/
|
||||
function Upper() {
|
||||
return DBField::create(get_class($this), strtoupper($this->value), $this->name);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user