Mage_Sales_Model_Mysql4_Order_Collection Class Reference

Inheritance diagram for Mage_Sales_Model_Mysql4_Order_Collection:

Mage_Eav_Model_Entity_Collection_Abstract Varien_Data_Collection_Db Varien_Data_Collection

List of all members.

Public Member Functions

 addItemCountExpr ()
 getSelectCountSql ()
 getAllIds ($limit=null, $offset=null)

Protected Member Functions

 _construct ()


Detailed Description

Definition at line 34 of file Collection.php.


Member Function Documentation

_construct (  )  [protected]

Initialize orders collection

Reimplemented from Mage_Eav_Model_Entity_Collection_Abstract.

Definition at line 40 of file Collection.php.

00041     {
00042         $this->_init('sales/order');
00043     }

addItemCountExpr (  ) 

Add order items count expression

Returns:
Mage_Sales_Model_Mysql4_Order_Collection

Definition at line 50 of file Collection.php.

00051     {
00052         $orderTable = $this->getEntity()->getEntityTable();
00053         $orderItemEntityTypeId = Mage::getResourceSingleton('sales/order_item')->getTypeId();
00054         $this->getSelect()->join(
00055                 array('items'=>$orderTable),
00056                 'items.parent_id=e.entity_id and items.entity_type_id='.$orderItemEntityTypeId,
00057                 array('items_count'=>new Zend_Db_Expr('COUNT(items.entity_id)'))
00058             )
00059             ->group('e.entity_id');
00060         return $this;
00061     }

getAllIds ( limit = null,
offset = null 
)

Retrive all ids for collection

Returns:
array

Reimplemented from Mage_Eav_Model_Entity_Collection_Abstract.

Definition at line 80 of file Collection.php.

00081     {
00082         $idsSelect = clone $this->getSelect();
00083         $idsSelect->reset(Zend_Db_Select::ORDER);
00084         $idsSelect->reset(Zend_Db_Select::LIMIT_COUNT);
00085         $idsSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
00086         $idsSelect->reset(Zend_Db_Select::COLUMNS);
00087         $idsSelect->from(null, 'e.'.$this->getEntity()->getIdFieldName());
00088         $idsSelect->limit($limit, $offset);
00089         $idsSelect->resetJoinLeft();
00090         return $this->getConnection()->fetchCol($idsSelect, $this->_bindParams);
00091     }

getSelectCountSql (  ) 

Minimize usual count select

Returns:
Varien_Db_Select

Reimplemented from Varien_Data_Collection_Db.

Definition at line 68 of file Collection.php.

00069     {
00070         $countSelect = parent::getSelectCountSql();
00071         $countSelect->resetJoinLeft();
00072         return $countSelect;
00073     }


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

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