Fixed DataObject::hasDatabaseField() for built-in fields (Created, etc)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@66110 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-11-18 01:49:29 +00:00
parent 3d9532db83
commit 5df7237a93

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