Mage_Rating_Model_Rating Class Reference

Inheritance diagram for Mage_Rating_Model_Rating:

Mage_Core_Model_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 addOptionVote ($optionId, $entityPkValue)
 updateOptionVote ($optionId)
 getOptions ()
 getEntitySummary ($entityPkValue, $onlyForCurrentStore=true)
 getReviewSummary ($reviewId, $onlyForCurrentStore=true)


Detailed Description

Definition at line 34 of file Rating.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Definition at line 36 of file Rating.php.

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


Member Function Documentation

addOptionVote ( optionId,
entityPkValue 
)

Definition at line 41 of file Rating.php.

00042     {
00043         Mage::getModel('rating/rating_option')->setOptionId($optionId)
00044             ->setRatingId($this->getId())
00045             ->setReviewId($this->getReviewId())
00046             ->setEntityPkValue($entityPkValue)
00047             ->addVote();
00048         return $this;
00049     }

getEntitySummary ( entityPkValue,
onlyForCurrentStore = true 
)

Get rating collection object

Returns:
Varien_Data_Collection_Db

Definition at line 87 of file Rating.php.

00088     {
00089         $this->setEntityPkValue($entityPkValue);
00090         return $this->_getResource()->getEntitySummary($this, $onlyForCurrentStore);
00091     }

getOptions (  ) 

retrieve rating options

Returns:
array

Definition at line 66 of file Rating.php.

00067     {
00068         if ($options = $this->getData('options')) {
00069             return $options;
00070         }
00071         elseif ($id = $this->getId()) {
00072             return Mage::getResourceModel('rating/rating_option_collection')
00073                ->addRatingFilter($id)
00074                ->setPositionOrder()
00075                ->load()
00076                ->getItems();
00077         }
00078         return array();
00079     }

getReviewSummary ( reviewId,
onlyForCurrentStore = true 
)

Definition at line 93 of file Rating.php.

00094     {
00095         $this->setReviewId($reviewId);
00096         return $this->_getResource()->getReviewSummary($this, $onlyForCurrentStore);
00097     }

updateOptionVote ( optionId  ) 

Definition at line 51 of file Rating.php.

00052     {
00053         Mage::getModel('rating/rating_option')->setOptionId($optionId)
00054             ->setVoteId($this->getVoteId())
00055             ->setReviewId($this->getReviewId())
00056             ->setDoUpdate(1)
00057             ->addVote();
00058         return $this;
00059     }


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