From b40dbbb2f00118dbc902f43ff19613cb29a21687 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 19 Nov 2008 23:29:30 +0000 Subject: [PATCH] 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 --- core/model/DataObject.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/model/DataObject.php b/core/model/DataObject.php index c58d2f164..20aeede72 100644 --- a/core/model/DataObject.php +++ b/core/model/DataObject.php @@ -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()); }