Query Pages based on Custom Attribute Value

Permalink
Hello Concrete5'ers

Has anyone managed to easily retrieve a list of pages programatically based on a custom attribute value outside of crafting some custom SQL statement?

I can appreciate a lookup of this kind would be horrible on a page load basis, this is a purely back-end operation (related to populating an external SOLR index).

Cheers,
Mark

ggn06awu
 
Mainio replied on at Permalink Best Answer Reply
Mainio
Loader::model('page_list');
$pl = new PageList();
$pl->filterByAttribute('your_custom_attribute_handle', 'desired_value');
$pages = $pl->get();
ggn06awu replied on at Permalink Reply
ggn06awu
Perfect, many thanks!