BUGFIX: Flush cache after deleting an item.

BUGFIX: Fixed databaseFieldsOnly version of DataObject::getChangedFields()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@101116 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-03-16 03:17:44 +00:00
parent 25836a1bea
commit 34d53dc42d

View File

@ -1119,6 +1119,8 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
$sql->execute(); $sql->execute();
} }
} }
// Remove this item out of any caches
$this->flushCache();
$this->onAfterDelete(); $this->onAfterDelete();
@ -2011,8 +2013,12 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
} }
if($databaseFieldsOnly) { if($databaseFieldsOnly) {
$customDatabaseFields = self::custom_database_fields($this->class); $databaseFields = $this->inheritedDatabaseFields();
$fields = array_intersect_key($this->changed, $customDatabaseFields); $databaseFields['ID'] = true;
$databaseFields['LastEdited'] = true;
$databaseFields['Created'] = true;
$databaseFields['ClassName'] = true;
$fields = array_intersect_key((array)$this->changed, $databaseFields);
} else { } else {
$fields = $this->changed; $fields = $this->changed;
} }