Get IDs of files in a FileSet

Permalink 1 user found helpful
I am trying to get an array of IDs of files in a fileset. Does anyone have a method to do this?

Thanks

cecil4
 
JohntheFish replied on at Permalink Reply
JohntheFish
cecil4 replied on at Permalink Reply
cecil4
I saw this but I'm more interested in how to do this programmatically seeing as how I am trying to use the file ID's in a block I am creating.
aghouseh replied on at Permalink Best Answer Reply
aghouseh
This should really be part of the FileSet model.. to return an array of Files within, but I digress. Here's what I use:

Loader::model('file_set');
Loader::model('file_list');
$fs = FileSet::getByName('My Fileset');
$fileList = new FileList();            
$fileList->filterBySet($fs);
$files = $fileList->get();
foreach ($files as $file) {
  // do things here .. or not
}