I'm trying to get all the entries which have tags associated with them.
At the moment I'm doing:
$entries = Entry::find()->with('tags')->all();
and then filtering the results in PHP as follows:
$filteredEntries = array_filter($entries, function($entry) {
return count($entry['tags']) > 0;
});
This works fine, but I am still fetching all the entries, even without tags from the DB - I think this can be more efficient if I can specify in my query that I only want the entries with tags associated to them. How can I do this?