Mage_Rating_Model_Mysql4_Rating_Option_Vote_Collection Class Reference

Inheritance diagram for Mage_Rating_Model_Mysql4_Rating_Option_Vote_Collection:

Mage_Core_Model_Mysql4_Collection_Abstract Varien_Data_Collection_Db Varien_Data_Collection

List of all members.

Public Member Functions

 _construct ()
 setReviewFilter ($reviewId)
 setEntityPkFilter ($entityId)
 setStoreFilter ($storeId)
 addRatingInfo ($storeId=null)
 addOptionInfo ()
 addRatingOptions ()


Detailed Description

Definition at line 35 of file Collection.php.


Member Function Documentation

_construct (  ) 

Initialization here

Reimplemented from Mage_Core_Model_Mysql4_Collection_Abstract.

Definition at line 37 of file Collection.php.

00038     {
00039         $this->_init('rating/rating_option_vote');
00040     }

addOptionInfo (  ) 

Definition at line 83 of file Collection.php.

00084     {
00085         $this->_select->join($this->getTable('rating/rating_option'), "main_table.option_id = {$this->getTable('rating/rating_option')}.option_id", "{$this->getTable('rating/rating_option')}.*");
00086         return $this;
00087     }

addRatingInfo ( storeId = null  ) 

Definition at line 60 of file Collection.php.

00061     {
00062         $this->_select->join($this->getTable('rating/rating'), "{$this->getTable('rating/rating')}.rating_id = main_table.rating_id", "{$this->getTable('rating/rating')}.*")
00063             ->joinLeft(array('title'=>$this->getTable('rating/rating_title')),
00064                           "main_table.rating_id=title.rating_id AND title.store_id = ". (int) Mage::app()->getStore()->getId(),
00065                           array("IF(title.value IS NULL, {$this->getTable('rating/rating')}.rating_code, title.value) AS rating_code"));
00066 
00067         if($storeId == null) {
00068             $storeId = Mage::app()->getStore()->getId();
00069         }
00070 
00071         if(is_array($storeId)) {
00072             $condition = $this->getConnection()->quoteInto('store.store_id IN(?)', $storeId);
00073         } else {
00074             $condition = $this->getConnection()->quoteInto('store.store_id = ?', $storeId);
00075         }
00076 
00077         $this->_select->join(array('store'=>$this->getTable('rating_store')), 'main_table.rating_id = store.rating_id AND '. $condition);
00078         $this->_select->group('main_table.vote_id');
00079 
00080         return $this;
00081     }

addRatingOptions (  ) 

Definition at line 89 of file Collection.php.

00090     {
00091         if( !$this->getSize() ) {
00092             return $this;
00093         }
00094         foreach( $this->getItems() as $item ) {
00095             $options = Mage::getModel('rating/rating_option')
00096                     ->getResourceCollection()
00097                     ->addRatingFilter($item->getRatingId())
00098                     ->load();
00099 
00100             if( $item->getRatingId() ) {
00101                 $item->setRatingOptions($options);
00102             } else {
00103                 return;
00104             }
00105         }
00106         return $this;
00107     }

setEntityPkFilter ( entityId  ) 

Definition at line 48 of file Collection.php.

00049     {
00050         $this->_select->where("entity_pk_value = ?", $entityId);
00051         return $this;
00052     }

setReviewFilter ( reviewId  ) 

Definition at line 42 of file Collection.php.

00043     {
00044         $this->_select->where("main_table.review_id = ?", $reviewId);
00045         return $this;
00046     }

setStoreFilter ( storeId  ) 

Definition at line 54 of file Collection.php.

00055     {
00056         $this->_select->join(array('rstore'=>$this->getTable('review/review_store')), 'main_table.review_id=rstore.review_id AND rstore.store_id=' . (int)$storeId, array());
00057         return $this;
00058     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:36 2009 for Magento by  doxygen 1.5.8