BUGFIX: Make DataObject::dbObject('ClassName') work.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@90632 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-11-02 06:27:00 +00:00
parent 3611156794
commit b5a5500ff4

View File

@ -2372,6 +2372,11 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
} else if(preg_match('/ID$/', $fieldName) && $this->has_one(substr($fieldName,0,-2))) {
$val = (isset($this->record[$fieldName])) ? $this->record[$fieldName] : null;
return DBField::create('ForeignKey', $val, $fieldName, $this);
// Special case for ClassName
} else if($fieldName == 'ClassName') {
$val = get_class($this);
return DBField::create('Varchar', $val, $fieldName, $this);
}
}