I'm pulling images from a DataObject.
When returning the ArrayList non of the methods work (sort limit reverse...)
public function getMixedGallery(){
$startPage = StartPage::get()->First();
$mixedGalleriesField = $startPage->MixedGalleries;
$fieldArray = explode(",", $mixedGalleriesField);
$images = ArrayList::create();
foreach($fieldArray as $id){
foreach(Dataobject::get('Product')->filter(array('ID' => $id, 'ShowProductImages' => '1')) as $gallery) {
if($gallery->MyImages()->Count() > 0){
$imagesForGallery = new ArrayData(array('myimage' => $gallery->MyImages(), 'mylink' => $gallery->Link()));
$images->push($imagesForGallery);
}
}
}
$images = $images->reverse()->sort('RAND()')->limit(intval(trim($startPage->NumGallery)));
return $images;
}
thanks.timo