BUGFIX: Merged from trunk; fix DataObject::hasDatabaseFields()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@66269 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-11-19 23:29:30 +00:00
parent 0eac163b11
commit b40dbbb2f0

View File

@ -1756,6 +1756,18 @@ class DataObject extends ViewableData implements DataObjectInterface,i18nEntityP
* @return boolean
*/
public function hasDatabaseField($field) {
$fixedFields = array(
'ID' => 'Int',
'ClassName' => 'Enum',
'LastEdited' => 'SSDatetime',
'Created' => 'SSDatetime',
// Add fields from Versioned decorator
'Version' => $this->hasExtension('Versioned') ? 'Int' : false,
);
// Add base fields which are not defined in static $db
if(isset($fixedFields[$field])) return (bool)$fixedFields[$field];
return array_key_exists($field, $this->inheritedDatabaseFields());
}