I'm writing a Zend 1.12 application involving election results. I can use the DbTable fetchAll to retrieve only candidates in a specific riding, but I'd like to order them by vote from most to least (DSC) (instead of the default least to most (ASC)).
//class Application_Model_CandidateMapper
public function fetchForRiding($riding)
{
$where = 'riding = %s';
$resultSet = $this->getDbTable()->fetchAll(sprintf($where, $riding), 'votes');
//blah blah blah
return $candidates
}
This gets the candidates for the riding and orders them by vote, but in ASC instead of DSC. I tried to jack 'DSC' into the fetchAll arguments a few different ways and the database complained it was being asked to ORDER BY 'votes DSC' ASC
.