Hi,
This is all for SS3
I have defined the following function in my controller:
public function PaginatedChildren() {
$paginatedList = new PaginatedList($this->Children(), $this->request);
if( $this->NChildren == 0 ) $nChildren = 10;
else $nChildren = $this->NChildren;
$paginatedList->setPageLength( $nChildren );
return $paginatedList;
}
I would like to be able to sort and filter the output of Children() before wrapping it in a PaginatedList and sending it to the template.
I have checked the API documentation to find the Children function, but the closest thing i found was the ChildrenOf method in ContentController. So I am curious where Children() is documented. Is it just an alias to ChildrenOf? If so where are these aliases defined.
These questions are more a matter of curiosity than anything, but I would really like to know how to sort and filter the output of $this->Children() in the controller. ChildrenOf() returns an SS_List, so I assume Children() returns one too. But SS_List doesn't have any sorting or filtering options and the documentation even goes far as to say that add doesn't guarantee a position in the list.
Given this what is the best way to proceed?
Should I be using custom SQL, maybe DataList?
Should I wrap the SS_List with SS_ListDecorator which appears to have exactly the functionality I need (although it appears to be completely undocumented)
Or is there another way to do this?
I am leaning more towards DataList as I guess this would pass off the filtering and sorting to the database server, which I suppose would be preferable. On the other hand SS_ListDecorator looks so much easier to implement (if only it was documented).
Also what is the preferred way of accessing $_GET parameters in the controller?
Thank You.