I don't use Phalcon much and am having some trouble with some code after a migration to Phalcon v3 with code that worked before.
foreach($this->facets as $k => $facet) {
$facets[$facet] = $results->getNext()->fetchAllAssoc();
}
The problem now is that I can see that when $results->getNext() returns an object with a null result and num_rows of 0, the chained fetchAllAssoc() gives an exception.
How can I recode this so that a fetchAllAssoc() is not done unless getNext() returned a valid result?
This is what I ended up doing. May not be a very elegant solution but it works. I'd be happy to see suggestions for improving it.