Skip to content
This repository
Browse code

BUGFIX Convert pages from DataList to ArrayList in CMSBatchActionHand…

…ler to avoid problems on merge()
  • Loading branch information...
commit 64db811d653d6e2de2c83f9f36b0f8168a964555 1 parent d04fe07
Ingo Schommer authored March 09, 2012

Showing 1 changed file with 8 additions and 2 deletions. Show diff stats Hide diff stats

  1. 10  admin/code/CMSBatchActionHandler.php
10  admin/code/CMSBatchActionHandler.php
@@ -111,8 +111,14 @@ function handleAction($request) {
111 111
 						implode(", ", $idsFromLive)
112 112
 					);
113 113
 					$livePages = Versioned::get_by_stage($this->recordClass, 'Live', $sql);
114  
-					if($pages) $pages->merge($livePages);
115  
-					else $pages = $livePages;
  114
+					if($pages) {
  115
+						// Can't merge into a DataList, need to condense into an actual list first
  116
+						// (which will retrieve all records as objects, so its an expensive operation)
  117
+						$pages = new ArrayList($pages->toArray());
  118
+						$pages->merge($livePages);
  119
+					}	else {
  120
+						$pages = $livePages;
  121
+					}
116 122
 				}
117 123
 			}
118 124
 		} else {

0 notes on commit 64db811

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