Merged revisions 52293 via svnmerge from

http://svn.silverstripe.com/open/modules/sapphire/branches/2.2.2

........
  r52293 | aoneil | 2008-04-08 12:03:43 +1200 (Tue, 08 Apr 2008) | 2 lines
  
  don't cache in overridden instance_get(), as the fields are different for subclasses
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@53509 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-04-26 06:47:29 +00:00
parent 88d79d1b62
commit 091c0afc2e

View File

@ -486,19 +486,18 @@ class File extends DataObject {
// Work out which columns we're actually going to select // Work out which columns we're actually going to select
// In short, we select everything except File.Content // In short, we select everything except File.Content
$filteredSelect = array(); $dataobject_select = array();
foreach($query->select as $i => $item) { foreach($query->select as $item) {
if($item == "`File`.*") { if($item == "`File`.*") {
if(!isset(self::$cache_file_fields)) self::$cache_file_fields = DB::query("SHOW FIELDS IN `File`")->column(); $fileColumns = DB::query("SHOW FIELDS IN `File`")->column();
$columnsToAdd = array_diff(self::$cache_file_fields, $excludeDbColumns); $columnsToAdd = array_diff($fileColumns, $excludeDbColumns);
foreach($columnsToAdd as $otherItem) { foreach($columnsToAdd as $otherItem) $dataobject_select[] = '`File`.' . $otherItem;
$filteredSelect[] = '`File`.' . $otherItem;
}
} else { } else {
$filteredSelect[] = $item; $dataobject_select[] = $item;
} }
} }
$query->select = $filteredSelect;
$query->select = $dataobject_select;
$records = $query->execute(); $records = $query->execute();
$ret = $this->buildDataObjectSet($records, $containerClass); $ret = $this->buildDataObjectSet($records, $containerClass);