Changeset 9255
- Timestamp:
- 05/25/08 23:11:20 (5 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfRatingPlugin/trunk/lib/behavior/sfRatingDoctrineTemplate.class.php
r9254 r9255 12 12 * @package sfLucenePlugin 13 13 * @subpackage Behavior 14 * @author Carl Vondrick <carlv@carlsoft.net>14 * @author Gordon Franke 15 15 */ 16 16 class sfRatingDoctrineTemplate extends Doctrine_Template … … 29 29 * Counts ratings made on given ratable object. 30 30 * 31 * @param BaseObject $object32 31 * @return int 33 32 */ 34 public function countRatings($object) 35 { 36 $c = new Criteria(); 37 $c->add(sfRatingPeer::RATABLE_ID, sfRatingToolkit::getReferenceKey($object)); 38 $c->add(sfRatingPeer::RATABLE_MODEL, get_class($object)); 39 return sfRatingPeer::doCount($c); 33 public function countRatings() 34 { 35 $object = $this->getInvoker(); 36 return Doctrine_Query::create() 37 ->from('sfRating') 38 ->where('ratable_id = ? AND ratable_model = ?') 39 ->count(array(sfRatingToolkit::getReferenceKey($object), get_class($object))); 40 40 } 41 41 … … 71 71 * Gets the object rating details 72 72 * 73 * @author Gordon Franke74 73 * @param boolean $include_all Shall we include all available ratings? 75 74 * @return associative array containing (rating => count)