/** * Retrieve number of votes * */ public function getNumberOfVotes() { // // SELECT COUNT( location_vote.vote ) AS count FROM location_vote WHERE location_id = 1 GROUP BY location_id $query = new Doctrine_Query(); $number = $query->select('COUNT(v.vote) count') ->from('LocationVote v') ->where('LocationVote.location_id = ?', $this->getId()) ->groupby('LocationVote.location_id') ->execute(); return $number; }