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:
Sam Minnee 2009-11-09 07:59:23 +00:00
parent 601430653a
commit c9a6d3a1b0
2 changed files with 22 additions and 0 deletions

View File

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

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