Mage_Core_Model_Mysql4_Collection_Abstract Class Reference

Inheritance diagram for Mage_Core_Model_Mysql4_Collection_Abstract:

Varien_Data_Collection_Db Varien_Data_Collection Mage_Admin_Model_Mysql4_Permissions_Collection Mage_Admin_Model_Mysql4_Role_Collection Mage_Admin_Model_Mysql4_Roles_Collection Mage_Admin_Model_Mysql4_Roles_User_Collection Mage_Admin_Model_Mysql4_Rules_Collection Mage_Admin_Model_Mysql4_User_Collection Mage_AdminNotification_Model_Mysql4_Inbox_Collection Mage_AmazonPayments_Model_Mysql4_Api_Debug_Collection Mage_Api_Model_Mysql4_Acl_Role_Collection Mage_Api_Model_Mysql4_Permissions_Collection Mage_Api_Model_Mysql4_Role_Collection Mage_Api_Model_Mysql4_Roles_Collection Mage_Api_Model_Mysql4_Roles_User_Collection Mage_Api_Model_Mysql4_Rules_Collection Mage_Api_Model_Mysql4_User_Collection Mage_Bundle_Model_Mysql4_Option_Collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Flat_Collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Value_Collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Type_Configurable_Attribute_Collection Mage_Catalog_Model_Resource_Eav_Mysql4_Sendfriend_Collection Mage_CatalogInventory_Model_Mysql4_Stock_Item_Collection Mage_CatalogRule_Model_Mysql4_Rule_Collection Mage_CatalogRule_Model_Mysql4_Rule_Product_Price_Collection Mage_CatalogSearch_Model_Mysql4_Query_Collection Mage_Checkout_Model_Mysql4_Agreement_Collection Mage_Cms_Model_Mysql4_Block_Collection Mage_Cms_Model_Mysql4_Page_Collection Mage_Core_Model_Mysql4_Config_Data_Collection Mage_Core_Model_Mysql4_Convert_History_Collection Mage_Core_Model_Mysql4_Convert_Profile_Collection Mage_Core_Model_Mysql4_Design_Collection Mage_Core_Model_Mysql4_Language_Collection Mage_Core_Model_Mysql4_Store_Collection Mage_Core_Model_Mysql4_Store_Group_Collection Mage_Core_Model_Mysql4_Url_Rewrite_Collection Mage_Core_Model_Mysql4_Website_Collection Mage_Cron_Model_Mysql4_Schedule_Collection Mage_Customer_Model_Entity_Group_Collection Mage_Dataflow_Model_Mysql4_Batch_Collection Mage_Dataflow_Model_Mysql4_Import_Collection Mage_Dataflow_Model_Mysql4_Profile_Collection Mage_Dataflow_Model_Mysql4_Profile_History_Collection Mage_Directory_Model_Mysql4_Country_Format_Collection Mage_Downloadable_Model_Mysql4_Link_Collection Mage_Downloadable_Model_Mysql4_Link_Purchased_Collection Mage_Downloadable_Model_Mysql4_Link_Purchased_Item_Collection Mage_Downloadable_Model_Mysql4_Sample_Collection Mage_Eav_Model_Mysql4_Entity_Attribute_Collection Mage_Eav_Model_Mysql4_Entity_Attribute_Group_Collection Mage_Eav_Model_Mysql4_Entity_Attribute_Option_Collection Mage_Eav_Model_Mysql4_Entity_Attribute_Set_Collection Mage_Eav_Model_Mysql4_Entity_Type_Collection Mage_GiftMessage_Model_Mysql4_Message_Collection Mage_GiftRegistry_Model_Mysql4_Gift_Collection Mage_GoogleBase_Model_Mysql4_Attribute_Collection Mage_GoogleBase_Model_Mysql4_Item_Collection Mage_GoogleBase_Model_Mysql4_Type_Collection Mage_GoogleCheckout_Model_Mysql4_Api_Debug_Collection Mage_GoogleOptimizer_Model_Mysql4_Code_Collection Mage_Log_Model_Mysql4_Visitor_Online_Collection Mage_Newsletter_Model_Mysql4_Problem_Collection Mage_Newsletter_Model_Mysql4_Queue_Collection Mage_Paygate_Model_Mysql4_Authorizenet_Debug_Collection Mage_Paypal_Model_Mysql4_Api_Debug_Collection Mage_PaypalUk_Model_Mysql4_Api_Debug_Collection Mage_Poll_Model_Mysql4_Poll_Answer_Collection Mage_Poll_Model_Mysql4_Poll_Collection Mage_ProductAlert_Model_Mysql4_Price_Collection Mage_ProductAlert_Model_Mysql4_Stock_Collection Mage_Rating_Model_Mysql4_Rating_Collection Mage_Rating_Model_Mysql4_Rating_Option_Vote_Collection Mage_Reports_Model_Mysql4_Event_Collection Mage_Reports_Model_Mysql4_Event_Type_Collection Mage_Reports_Model_Mysql4_Wishlist_Collection Mage_Rule_Model_Mysql4_Rule_Collection Mage_Sales_Model_Mysql4_Order_Item_Collection Mage_Sales_Model_Mysql4_Order_Tax_Collection Mage_Sales_Model_Mysql4_Quote_Address_Collection Mage_Sales_Model_Mysql4_Quote_Address_Item_Collection Mage_Sales_Model_Mysql4_Quote_Address_Rate_Collection Mage_Sales_Model_Mysql4_Quote_Collection Mage_Sales_Model_Mysql4_Quote_Item_Collection Mage_Sales_Model_Mysql4_Quote_Item_Option_Collection Mage_Sales_Model_Mysql4_Quote_Payment_Collection Mage_SalesRule_Model_Mysql4_Rule_Collection Mage_SalesRule_Model_Mysql4_Rule_Customer_Collection Mage_SalesRule_Model_Mysql4_Rule_Product_Collection Mage_Sendfriend_Model_Mysql4_Sendfriend_Collection Mage_Sitemap_Model_Mysql4_Sitemap_Collection Mage_Tag_Model_Mysql4_Popular_Collection Mage_Tag_Model_Mysql4_Tag_Collection Mage_Tax_Model_Mysql4_Calculation_Collection Mage_Tax_Model_Mysql4_Calculation_Rate_Collection Mage_Tax_Model_Mysql4_Calculation_Rate_Title_Collection Mage_Tax_Model_Mysql4_Calculation_Rule_Collection Mage_Tax_Model_Mysql4_Class_Collection

List of all members.

Public Member Functions

 __construct ($resource=null)
 setModel ($model)
 getModelName ($args=array())
 setResourceModel ($model)
 getResourceModelName ()
 getResource ()
 getTable ($table)
 getAllIds ()
 join ($table, $cond, $cols='*')
 load ($printQuery=false, $logQuery=false)
 save ()

Protected Member Functions

 _construct ()
 _initSelect ()
 _init ($model, $resourceModel=null)
 _canUseCache ()
 _getCacheTags ()

Protected Attributes

 $_model
 $_resourceModel
 $_resource
 $_joinedTables = array()


Detailed Description

Definition at line 28 of file Abstract.php.


Constructor & Destructor Documentation

__construct ( resource = null  ) 

Collection constructor

Parameters:
Mage_Core_Model_Mysql4_Abstract $resource

Reimplemented from Varien_Data_Collection_Db.

Definition at line 63 of file Abstract.php.

00064     {
00065         parent::__construct();
00066         $this->_construct();
00067         $this->_resource = $resource;
00068         $this->setConnection($this->getResource()->getReadConnection());
00069         $this->_initSelect();
00070     }


Member Function Documentation

_canUseCache (  )  [protected]

Reimplemented from Varien_Data_Collection_Db.

Definition at line 214 of file Abstract.php.

00215     {
00216         return Mage::app()->useCache('collections');
00217     }

_construct (  )  [protected]

Initialization here

Reimplemented in Mage_Admin_Model_Mysql4_Permissions_Collection, Mage_Admin_Model_Mysql4_Role_Collection, Mage_Admin_Model_Mysql4_Roles_Collection, Mage_Admin_Model_Mysql4_Roles_User_Collection, Mage_Admin_Model_Mysql4_Rules_Collection, Mage_Admin_Model_Mysql4_User_Collection, Mage_AdminNotification_Model_Mysql4_Inbox_Collection, Mage_AmazonPayments_Model_Mysql4_Api_Debug_Collection, Mage_Api_Model_Mysql4_Acl_Role_Collection, Mage_Api_Model_Mysql4_Permissions_Collection, Mage_Api_Model_Mysql4_Role_Collection, Mage_Api_Model_Mysql4_Roles_Collection, Mage_Api_Model_Mysql4_Roles_User_Collection, Mage_Api_Model_Mysql4_Rules_Collection, Mage_Api_Model_Mysql4_User_Collection, Mage_Bundle_Model_Mysql4_Option_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Flat_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Value_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Type_Configurable_Attribute_Collection, Mage_Catalog_Model_Resource_Eav_Mysql4_Sendfriend_Collection, Mage_CatalogInventory_Model_Mysql4_Stock_Item_Collection, Mage_CatalogRule_Model_Mysql4_Rule_Collection, Mage_CatalogRule_Model_Mysql4_Rule_Product_Price_Collection, Mage_CatalogSearch_Model_Mysql4_Query_Collection, Mage_Checkout_Model_Mysql4_Agreement_Collection, Mage_Cms_Model_Mysql4_Block_Collection, Mage_Cms_Model_Mysql4_Page_Collection, Mage_Core_Model_Mysql4_Config_Data_Collection, Mage_Core_Model_Mysql4_Convert_History_Collection, Mage_Core_Model_Mysql4_Convert_Profile_Collection, Mage_Core_Model_Mysql4_Design_Collection, Mage_Core_Model_Mysql4_Language_Collection, Mage_Core_Model_Mysql4_Store_Collection, Mage_Core_Model_Mysql4_Store_Group_Collection, Mage_Core_Model_Mysql4_Url_Rewrite_Collection, Mage_Core_Model_Mysql4_Website_Collection, Mage_Cron_Model_Mysql4_Schedule_Collection, Mage_Customer_Model_Entity_Group_Collection, Mage_Dataflow_Model_Mysql4_Batch_Collection, Mage_Dataflow_Model_Mysql4_Import_Collection, Mage_Dataflow_Model_Mysql4_Profile_Collection, Mage_Dataflow_Model_Mysql4_Profile_History_Collection, Mage_Directory_Model_Mysql4_Country_Format_Collection, Mage_Downloadable_Model_Mysql4_Link_Collection, Mage_Downloadable_Model_Mysql4_Link_Purchased_Collection, Mage_Downloadable_Model_Mysql4_Link_Purchased_Item_Collection, Mage_Downloadable_Model_Mysql4_Sample_Collection, Mage_Eav_Model_Mysql4_Entity_Attribute_Collection, Mage_Eav_Model_Mysql4_Entity_Attribute_Group_Collection, Mage_Eav_Model_Mysql4_Entity_Attribute_Option_Collection, Mage_Eav_Model_Mysql4_Entity_Attribute_Set_Collection, Mage_Eav_Model_Mysql4_Entity_Type_Collection, Mage_GiftMessage_Model_Mysql4_Message_Collection, Mage_GiftRegistry_Model_Mysql4_Gift_Collection, Mage_GoogleBase_Model_Mysql4_Attribute_Collection, Mage_GoogleBase_Model_Mysql4_Item_Collection, Mage_GoogleBase_Model_Mysql4_Type_Collection, Mage_GoogleCheckout_Model_Mysql4_Api_Debug_Collection, Mage_GoogleOptimizer_Model_Mysql4_Code_Collection, Mage_Log_Model_Mysql4_Visitor_Online_Collection, Mage_Newsletter_Model_Mysql4_Problem_Collection, Mage_Newsletter_Model_Mysql4_Queue_Collection, Mage_Paygate_Model_Mysql4_Authorizenet_Debug_Collection, Mage_Paypal_Model_Mysql4_Api_Debug_Collection, Mage_PaypalUk_Model_Mysql4_Api_Debug_Collection, Mage_Poll_Model_Mysql4_Poll_Answer_Collection, Mage_Poll_Model_Mysql4_Poll_Collection, Mage_ProductAlert_Model_Mysql4_Price_Collection, Mage_ProductAlert_Model_Mysql4_Stock_Collection, Mage_Rating_Model_Mysql4_Rating_Collection, Mage_Rating_Model_Mysql4_Rating_Option_Vote_Collection, Mage_Reports_Model_Mysql4_Event_Collection, Mage_Reports_Model_Mysql4_Event_Type_Collection, Mage_Reports_Model_Mysql4_Wishlist_Collection, Mage_Rule_Model_Mysql4_Rule_Collection, Mage_Sales_Model_Mysql4_Order_Item_Collection, Mage_Sales_Model_Mysql4_Order_Tax_Collection, Mage_Sales_Model_Mysql4_Quote_Address_Collection, Mage_Sales_Model_Mysql4_Quote_Address_Item_Collection, Mage_Sales_Model_Mysql4_Quote_Address_Rate_Collection, Mage_Sales_Model_Mysql4_Quote_Collection, Mage_Sales_Model_Mysql4_Quote_Item_Collection, Mage_Sales_Model_Mysql4_Quote_Item_Option_Collection, Mage_Sales_Model_Mysql4_Quote_Payment_Collection, Mage_SalesRule_Model_Mysql4_Rule_Collection, Mage_SalesRule_Model_Mysql4_Rule_Customer_Collection, Mage_SalesRule_Model_Mysql4_Rule_Product_Collection, Mage_Sendfriend_Model_Mysql4_Sendfriend_Collection, Mage_Sitemap_Model_Mysql4_Sitemap_Collection, Mage_Tag_Model_Mysql4_Popular_Collection, Mage_Tag_Model_Mysql4_Tag_Collection, Mage_Tax_Model_Mysql4_Calculation_Collection, Mage_Tax_Model_Mysql4_Calculation_Rate_Collection, Mage_Tax_Model_Mysql4_Calculation_Rate_Title_Collection, Mage_Tax_Model_Mysql4_Calculation_Rule_Collection, and Mage_Tax_Model_Mysql4_Class_Collection.

Definition at line 76 of file Abstract.php.

00077     {
00078 
00079     }

_getCacheTags (  )  [protected]

Redeclared for processing cache tags throw application object

Returns:
array

Reimplemented from Varien_Data_Collection_Db.

Definition at line 224 of file Abstract.php.

00225     {
00226         $tags = parent::_getCacheTags();
00227         foreach ($tags as $key => $value) {
00228             $tags[$key] = Mage::app()->prepareCacheId($value);
00229         }
00230         $tags[] = Mage_Core_Model_App::CACHE_TAG;
00231         return $tags;
00232     }

_init ( model,
resourceModel = null 
) [protected]

Standard resource collection initalization

Parameters:
string $model
Returns:
Mage_Core_Model_Mysql4_Collection_Abstract

Definition at line 93 of file Abstract.php.

00094     {
00095         $this->setModel($model);
00096         if (is_null($resourceModel)) {
00097             $resourceModel = $model;
00098         }
00099         $this->setResourceModel($resourceModel);
00100         return $this;
00101     }

_initSelect (  )  [protected]

getAllIds (  ) 

Retrive all ids for collection

Returns:
array

Definition at line 162 of file Abstract.php.

00163     {
00164         $idsSelect = clone $this->getSelect();
00165         $idsSelect->reset(Zend_Db_Select::ORDER);
00166         $idsSelect->reset(Zend_Db_Select::LIMIT_COUNT);
00167         $idsSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
00168         $idsSelect->reset(Zend_Db_Select::COLUMNS);
00169         $idsSelect->from(null,
00170             'main_table.' . $this->getResource()->getIdFieldName()
00171         );
00172         return $this->getConnection()->fetchCol($idsSelect);
00173     }

getModelName ( args = array()  ) 

Get model instance

Parameters:
array $args
Returns:
Varien_Object

Definition at line 124 of file Abstract.php.

00125     {
00126         return $this->_model;
00127     }

getResource (  ) 

Get resource instance

Returns:
Mage_Core_Model_Mysql4_Abstract

Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Flat_Collection.

Definition at line 144 of file Abstract.php.

00145     {
00146         if (empty($this->_resource)) {
00147             $this->_resource = Mage::getResourceModel($this->getResourceModelName());
00148         }
00149         return $this->_resource;
00150     }

getResourceModelName (  ) 

Definition at line 134 of file Abstract.php.

00135     {
00136         return $this->_resourceModel;
00137     }

getTable ( table  ) 

Definition at line 152 of file Abstract.php.

00153     {
00154         return $this->getResource()->getTable($table);
00155     }

join ( table,
cond,
cols = '*' 
)

Definition at line 175 of file Abstract.php.

00176     {
00177         if (!isset($this->_joinedTables[$table])) {
00178             $this->getSelect()->join(array($table=>$this->getTable($table)), $cond, $cols);
00179             $this->_joinedTables[$table] = true;
00180         }
00181         return $this;
00182     }

load ( printQuery = false,
logQuery = false 
)

Load data

Returns:
Varien_Data_Collection_Db

Reimplemented from Varien_Data_Collection_Db.

Reimplemented in Mage_CatalogInventory_Model_Mysql4_Stock_Item_Collection, Mage_Core_Model_Mysql4_Store_Collection, Mage_Core_Model_Mysql4_Store_Group_Collection, Mage_Core_Model_Mysql4_Website_Collection, Mage_GoogleBase_Model_Mysql4_Attribute_Collection, Mage_Newsletter_Model_Mysql4_Problem_Collection, Mage_Newsletter_Model_Mysql4_Queue_Collection, Mage_Tag_Model_Mysql4_Popular_Collection, and Mage_Tag_Model_Mysql4_Tag_Collection.

Definition at line 189 of file Abstract.php.

00190     {
00191         if (!$this->isLoaded()) {
00192             Mage::dispatchEvent('core_collection_abstract_load_before', array('collection' => $this));
00193         }
00194         parent::load($printQuery, $logQuery);
00195         foreach ($this->_items as $item) {
00196             $item->setOrigData();
00197         }
00198         return $this;
00199     }

save (  ) 

Save all the entities in the collection

Returns:
Mage_Core_Model_Mysql4_Collection_Abstract

Definition at line 206 of file Abstract.php.

00207     {
00208         foreach ($this->getItems() as $item) {
00209             $item->save();
00210         }
00211         return $this;
00212     }

setModel ( model  ) 

Set model name for collection items

Parameters:
string $model
Returns:
Mage_Core_Model_Mysql4_Collection_Abstract

Definition at line 109 of file Abstract.php.

00110     {
00111         if (is_string($model)) {
00112             $this->_model = $model;
00113             $this->setItemObjectClass(Mage::getConfig()->getModelClassName($model));
00114         }
00115         return $this;
00116     }

setResourceModel ( model  ) 

Definition at line 129 of file Abstract.php.

00130     {
00131         $this->_resourceModel = $model;
00132     }


Member Data Documentation

$_joinedTables = array() [protected]

Definition at line 56 of file Abstract.php.

$_model [protected]

Definition at line 35 of file Abstract.php.

$_resource [protected]

Definition at line 49 of file Abstract.php.

$_resourceModel [protected]

Definition at line 42 of file Abstract.php.


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

Generated on Sat Jul 4 17:23:58 2009 for Magento by  doxygen 1.5.8