I have a channel (projects) that has two different entries fields (year & research theme), both of which I want to be able to search in a plugin.
The docs for the relatedTo entries method show under the heading "Passing Multiple Relation Criteria" that it's possible to do this within twig, however I'm not sure how to do this in my plugin using php. Obviously the below won't work:
# Find all projects that match the supplied year and research theme. $projectCriterea = craft()->elements->getCriteria(ElementType::Entry); $projectCriterea->section = 'projects'; # Something like this? $projectCriterea->customField1->relatedTo = $yearEntryModel; $projectCriterea->customField2->relatedTo = $researchThemeEntryModel; $projects = $projectCriterea->find();
Any help would be amazing. Thanks.