filterBySelectAttribute() Not working

Permalink
Hi,

Anyone know why filterBySelectAttribute() isn't working in 8.3.1?

Yeah is my code:

$values = array("Whitepaper", "Executive Briefing", "Guide", "Technical Document", "Fact Sheet");
$docList = new PageList();
$docList->filterByPageTypeHandle('pdf_page');
$docList->sortByDateModifiedDescending();
$docList->filterBySelectAttribute('pdf_type', $values);
$docList->getQueryObject()->setMaxResults(5);

$pages = $docList->getResults();

Please see screenshot of the error I get.

1 Attachment

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi JackVanson,

It looks like the filterBySelectAttribute() method is part of the legacy PageList class.
https://github.com/concrete5/concrete5/blob/e4c5d5ddab159f4508fede87...

Filtering by attribute now uses magic methods.
https://documentation.concrete5.org/developers/working-with-pages/se...

I think you can try:
$docList->filterByPdfType($values);