mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
3611156794
commit
b5a5500ff4
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user