Mage_Reports_Model_Mysql4_Review_Collection Class Reference

Inheritance diagram for Mage_Reports_Model_Mysql4_Review_Collection:

Mage_Review_Model_Mysql4_Review_Collection Varien_Data_Collection_Db Varien_Data_Collection

List of all members.

Public Member Functions

 addProductFilter ($productId)
 resetSelect ()
 getSelectCountSql ()
 setOrder ($attribute, $dir='desc')

Protected Member Functions

 _construct ()


Detailed Description

Definition at line 35 of file Collection.php.


Member Function Documentation

_construct (  )  [protected]

Definition at line 37 of file Collection.php.

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

addProductFilter ( productId  ) 

Definition at line 42 of file Collection.php.

00043     {
00044         $this->_select
00045             ->where('main_table.entity_pk_value = ?', $productId);
00046 
00047         return $this;
00048     }

getSelectCountSql (  ) 

Get SQL for get record count

Returns:
Varien_Db_Select

Reimplemented from Varien_Data_Collection_Db.

Definition at line 57 of file Collection.php.

00058     {
00059         $countSelect = clone $this->_select;
00060         $countSelect->reset(Zend_Db_Select::ORDER);
00061         $countSelect->reset(Zend_Db_Select::LIMIT_COUNT);
00062         $countSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
00063 
00064         $sql = $countSelect->__toString();
00065 
00066         $sql = preg_replace('/^select\s+.+?\s+from\s+/is', 'select count(main_table.review_id) from ', $sql);
00067 
00068         return $sql;
00069     }

resetSelect (  ) 

Definition at line 50 of file Collection.php.

00051     {
00052         parent::resetSelect();
00053         $this->_joinFields();
00054         return $this;
00055     }

setOrder ( field,
direction = 'desc' 
)

Add select order

Parameters:
string $field
string $direction
Returns:
Varien_Data_Collection_Db

Reimplemented from Varien_Data_Collection_Db.

Definition at line 71 of file Collection.php.

00072     {
00073         $fields = array(
00074             'nickname',
00075             'title',
00076             'detail',
00077             'created_at'
00078         );
00079 
00080         if (in_array($attribute, $fields)) {
00081                 $this->_select->order($attribute . ' ' . $dir);
00082         } else {
00083                 parent::setOrder($attribute, $dir);
00084         }
00085 
00086         return $this;
00087     }


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

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