API CHANGE: Added Lower and Upper methods to Varchar, Text, and Enum (from r91048)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92452 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 01:41:24 +00:00
parent 895644cf9f
commit 3878730edf
2 changed files with 22 additions and 0 deletions

View File

@ -74,6 +74,13 @@ class Enum extends DBField {
function enumValues($hasEmpty = false) { function enumValues($hasEmpty = false) {
return ($hasEmpty) ? array_merge(array('' => ''), ArrayLib::valuekey($this->enum)) : ArrayLib::valuekey($this->enum); return ($hasEmpty) ? array_merge(array('' => ''), ArrayLib::valuekey($this->enum)) : ArrayLib::valuekey($this->enum);
} }
function Lower() {
return StringField::Lower();
}
function Upper() {
return StringField::Upper();
}
} }
?> ?>

View File

@ -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);
}
} }