Skip to content
This repository
Browse code

BUGFIX: Fixed DataList operations to respect the fact that they're id…

…empotent.
  • Loading branch information...
commit 792c9058fa210ba0fd8e3fec4b812fffe988bd9c 1 parent c051b80
Sam Minnée authored
8  code/controllers/AssetAdmin.php
@@ -102,7 +102,7 @@ public function getList() {
102 102
 		// Re-add previously removed "Name" filter as combined filter
103 103
 		// TODO Replace with composite SearchFilter once that API exists
104 104
 		if(isset($params['Name'])) {
105  
-			$list->where(sprintf(
  105
+			$list = $list->where(sprintf(
106 106
 				'"Name" LIKE \'%%%s%%\' OR "Title" LIKE \'%%%s%%\'',
107 107
 				Convert::raw2sql($params['Name']),
108 108
 				Convert::raw2sql($params['Name'])
@@ -110,12 +110,12 @@ public function getList() {
110 110
 		}
111 111
 
112 112
 		// Always show folders at the top		
113  
-		$list->sort('(CASE WHEN "File"."ClassName" = \'Folder\' THEN 0 ELSE 1 END), "Name"');
  113
+		$list = $list->sort('(CASE WHEN "File"."ClassName" = \'Folder\' THEN 0 ELSE 1 END), "Name"');
114 114
 
115 115
 		// If a search is conducted, check for the "current folder" limitation.
116 116
 		// Otherwise limit by the current folder as denoted by the URL.
117 117
 		if(!$params || @$params['CurrentFolderOnly']) {
118  
-			$list->filter('ParentID', $folder->ID);
  118
+			$list = $list->filter('ParentID', $folder->ID);
119 119
 		}
120 120
 
121 121
 		// Category filter
@@ -124,7 +124,7 @@ public function getList() {
124 124
 			$categorySQLs = array();
125 125
 			foreach($exts as $ext) $categorySQLs[] = '"File"."Name" LIKE \'%.' . $ext . '\'';
126 126
 			// TODO Use DataList->filterAny() once OR connectives are implemented properly
127  
-			$list->where('(' . implode(' OR ', $categorySQLs) . ')');
  127
+			$list = $list->where('(' . implode(' OR ', $categorySQLs) . ')');
128 128
 		}
129 129
 
130 130
 		return $list;
6  code/controllers/CMSMain.php
@@ -477,7 +477,7 @@ public function PageTypes() {
477 477
 			)));
478 478
 		}
479 479
 		
480  
-		$result->sort('AddAction');
  480
+		$result = $result->sort('AddAction');
481 481
 		return $result;
482 482
 	}
483 483
 
@@ -658,9 +658,9 @@ public function getList($params, $parentID = 0) {
658 658
 			foreach($pages=$filter->pagesIncluded() as $pageMap){
659 659
 				$ids[] = $pageMap['ID'];
660 660
 			}
661  
-			if(count($ids)) $list->where('"'.$this->stat('tree_class').'"."ID" IN ('.implode(",", $ids).')');
  661
+			if(count($ids)) $list = $list->where('"'.$this->stat('tree_class').'"."ID" IN ('.implode(",", $ids).')');
662 662
 		} else {
663  
-			$list->filter("ParentID", is_numeric($parentID) ? $parentID : 0);
  663
+			$list = $list->filter("ParentID", is_numeric($parentID) ? $parentID : 0);
664 664
 		}
665 665
 
666 666
 		return $list;
2  code/reports/BrokenLinksReport.php
@@ -69,7 +69,7 @@ function sourceRecords($params, $sort, $limit) {
69 69
 			}
70 70
 		}
71 71
 		
72  
-		if($sortBrokenReason) $returnSet->sort('BrokenReason', $direction);
  72
+		if($sortBrokenReason) $returnSet = $returnSet->sort('BrokenReason', $direction);
73 73
 		
74 74
 		return $returnSet;
75 75
 	}
2  code/reports/Report.php
@@ -206,7 +206,7 @@ static function get_reports() {
206 206
 		$list = ArrayList::create($reportsArray);
207 207
 
208 208
 		//sort
209  
-		$list->sort('sort');
  209
+		$list = $list->sort('sort');
210 210
 
211 211
 		return $list;
212 212
 	}

0 notes on commit 792c905

Please sign in to comment.
Something went wrong with that request. Please try again.