Filter by multiple sets
Permalink
Is there a way of filtering multiple filesets with a single file list call, for example, looking in the code and this currently doesn't look possible?
$fs = FileSet::getByID(1, 2); $fl = new FileList(); $fl->filterBySet($fs); $fl->sortBy('fsDisplayOrder', 'asc'); $files = $fl->get();
Just wondering if you have actually tried this approach?
Yes, quickly, and this worked for me. But again, this code list only files who are in the two filesets at the same time, I don't know if this is what you expected, maybe I misunderstood.
If you want some tech details:
$fl->filterBySet() takes one fileset ID, and add it to a private array (filteredFileSetIDs).
https://github.com/concrete5/concrete5/blob/master/web/concrete/core...
This array is used to create the query:
https://github.com/concrete5/concrete5/blob/master/web/concrete/core...
If you want some tech details:
$fl->filterBySet() takes one fileset ID, and add it to a private array (filteredFileSetIDs).
https://github.com/concrete5/concrete5/blob/master/web/concrete/core...
This array is used to create the query:
https://github.com/concrete5/concrete5/blob/master/web/concrete/core...
I seem to be getting a blank array?
Ok so I probably misunderstood. I was thinking that you needed to get the files who are member of the two filesets, excluding files who are member of only one fileset.
Anyone else got any ideas?
- The list class has a method to extend with raw snippets of SQL, so you could take what is generated for 'AND', then in its place tack on the same query fragment with 'OR'.
- There are a couple of excellent recent forum threads on high performance listing. Use one of those with 'OR'.
- If extreme performance and size of list is not prohibitive, use Magic Data and Uber List.
- There are a couple of excellent recent forum threads on high performance listing. Use one of those with 'OR'.
- If extreme performance and size of list is not prohibitive, use Magic Data and Uber List.
Hi John, slightly lost there, would you mind showing an example?
This code list files in the 2 filesets, not the files only in one of them. Maybe this is not what you need.