Hi,
I've just updated my SS from 3.1 to 3.4 version and I have one small issue - sort function doesn't work anymore but not completelty.
Here is bit of my code:
public function RelatedDownloads() {
$Related = new ArrayList;
// take two items from download section
$DownloadPage = DownloadPage::get()->sort('RAND()')->limit(2);
// take one element from resource section from specific category
$RelatedResources = Resource::get();
$RelatedResources = $RelatedResources->leftJoin('Resource_Categories', "Resource.ID = Resource_Categories.ResourceID")->filter('Resource_Categories.ResourceCategoryID', array('5','6'))->sort('RAND()')->limit(1);
// merge downloads and resource together
foreach( $DownloadPage as $obj ) $Related->push( $obj );
foreach( $RelatedResources as $obj ) $Related->push( $obj );
// reorder them randomly
$Related = $Related->sort('_SortColumn0', 'RAND()');
return $Related;
}
That was working fine on 3.1 now I'm getting error:
[22-Jul-2016 14:41:05] Error at \framework\model\ArrayList.php line 378: Uncaught InvalidArgumentException: Invalid sort() direction (http://www.domain.com/documents/?download=10995)
However when I change RAND() to ASC or DESC it works fine...
Any clues?
Many thanks, Alessia.