All pastes #441009 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-15 13:00 UTC
rendered paste body
  /**
   * 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;
  }