Public Member Functions | |
getIdFieldName () | |
getId () | |
setId ($id) | |
getResourceName () | |
getResourceCollection () | |
getCollection () | |
load ($id, $field=null) | |
afterLoad () | |
save () | |
delete () | |
getResource () | |
getEntityId () | |
Protected Member Functions | |
_init ($resourceModel) | |
_setResourceModel ($resourceName, $resourceCollectionName=null) | |
_getResource () | |
_afterLoad () | |
_beforeSave () | |
_afterSave () | |
_beforeDelete () | |
_protectFromNonAdmin () | |
_afterDelete () | |
Protected Attributes | |
$_eventPrefix = 'core_abstract' | |
$_eventObject = 'object' | |
$_resourceName | |
$_resource | |
$_resourceCollectionName | |
$_cacheTag = false | |
$_dataSaveAllowed = true |
Definition at line 35 of file Abstract.php.
_afterDelete | ( | ) | [protected] |
Processing object after delete data
Reimplemented in Mage_Core_Model_Website, Mage_Dataflow_Model_Batch, Mage_Poll_Model_Poll_Answer, Mage_Tax_Model_Calculation_Rate, and Mage_Tax_Model_Calculation_Rule.
Definition at line 350 of file Abstract.php.
00351 { 00352 if ($this->_cacheTag) { 00353 if ($this->_cacheTag === true) { 00354 $tags = array(); 00355 } 00356 else { 00357 $tags = array($this->_cacheTag); 00358 } 00359 Mage::app()->cleanCache($tags); 00360 } 00361 Mage::dispatchEvent('model_delete_after', array('object'=>$this)); 00362 Mage::dispatchEvent($this->_eventPrefix.'_delete_after', array($this->_eventObject=>$this)); 00363 return $this; 00364 }
_afterLoad | ( | ) | [protected] |
Processing object after load data
Reimplemented in Mage_Adminhtml_Model_System_Config_Backend_Encrypted, Mage_Adminhtml_Model_System_Config_Backend_Serialized, Mage_Catalog_Model_Product, Mage_Core_Model_Convert_Profile, Mage_Dataflow_Model_Profile, Mage_GoogleOptimizer_Model_Code_Page, Mage_GoogleOptimizer_Model_Code_Product, Mage_Rule_Model_Rule, and Mage_Sales_Model_Quote.
Definition at line 227 of file Abstract.php.
00228 { 00229 Mage::dispatchEvent('model_load_after', array('object'=>$this)); 00230 Mage::dispatchEvent($this->_eventPrefix.'_load_after', array($this->_eventObject=>$this)); 00231 return $this; 00232 }
_afterSave | ( | ) | [protected] |
Processing object after save data
Reimplemented in Mage_Adminhtml_Model_System_Config_Backend_Admin_Custom, Mage_Adminhtml_Model_System_Config_Backend_Admin_Usesecretkey, Mage_Adminhtml_Model_System_Config_Backend_Cache, Mage_Adminhtml_Model_System_Config_Backend_Catalog_Inventory_Managestock, Mage_Adminhtml_Model_System_Config_Backend_Catalog_Search_Type, Mage_Adminhtml_Model_System_Config_Backend_Category, Mage_Adminhtml_Model_System_Config_Backend_Currency_Allow, Mage_Adminhtml_Model_System_Config_Backend_Currency_Base, Mage_Adminhtml_Model_System_Config_Backend_Currency_Cron, Mage_Adminhtml_Model_System_Config_Backend_Currency_Default, Mage_Adminhtml_Model_System_Config_Backend_Datashare, Mage_Adminhtml_Model_System_Config_Backend_Layer_Children, Mage_Adminhtml_Model_System_Config_Backend_Locale, Mage_Adminhtml_Model_System_Config_Backend_Log_Cron, Mage_Adminhtml_Model_System_Config_Backend_Product_Alert_Cron, Mage_Adminhtml_Model_System_Config_Backend_Seo_Product, Mage_Adminhtml_Model_System_Config_Backend_Shipping_Tablerate, Mage_Adminhtml_Model_System_Config_Backend_Sitemap_Cron, Mage_Adminhtml_Model_System_Config_Backend_Store, Mage_Catalog_Model_Entity_Attribute, Mage_Catalog_Model_Product_Option, Mage_Catalog_Model_Product_Type_Configurable_Attribute, Mage_Catalog_Model_Product, Mage_CatalogInventory_Model_Stock_Item, Mage_CatalogRule_Model_Rule, Mage_Core_Model_Convert_Profile, Mage_Dataflow_Model_Profile, Mage_Downloadable_Model_Link, Mage_Downloadable_Model_Sample, Mage_Eav_Model_Entity_Attribute, Mage_Poll_Model_Poll_Answer, Mage_Sales_Model_Quote_Address, Mage_Sales_Model_Quote_Item, Mage_Sales_Model_Quote, Mage_Tax_Model_Calculation_Rate, and Mage_Tax_Model_Calculation_Rule.
Definition at line 280 of file Abstract.php.
00281 { 00282 if ($this->_cacheTag) { 00283 if ($this->_cacheTag === true) { 00284 $tags = array(); 00285 } 00286 else { 00287 $tags = array($this->_cacheTag); 00288 } 00289 Mage::app()->cleanCache($tags); 00290 } 00291 Mage::dispatchEvent('model_save_after', array('object'=>$this)); 00292 Mage::dispatchEvent($this->_eventPrefix.'_save_after', array($this->_eventObject=>$this)); 00293 return $this; 00294 }
_beforeDelete | ( | ) | [protected] |
Processing object before delete data
Reimplemented in Mage_Catalog_Model_Category, Mage_Catalog_Model_Product, Mage_Core_Model_Store_Group, Mage_Core_Model_Store, Mage_Core_Model_Website, Mage_Customer_Model_Customer, Mage_Eav_Model_Entity_Attribute, Mage_Poll_Model_Poll_Answer, Mage_Review_Model_Review, Mage_Sales_Model_Order_Creditmemo, Mage_Sales_Model_Order_Invoice, Mage_Sales_Model_Order_Shipment, Mage_Sales_Model_Order, Mage_SalesRule_Model_Rule, and Mage_Tag_Model_Tag.
Definition at line 323 of file Abstract.php.
00324 { 00325 Mage::dispatchEvent('model_delete_before', array('object'=>$this)); 00326 Mage::dispatchEvent($this->_eventPrefix.'_delete_before', array($this->_eventObject=>$this)); 00327 return $this; 00328 }
_beforeSave | ( | ) | [protected] |
Processing object before save data
Reimplemented in Mage_Adminhtml_Model_System_Config_Backend_Admin_Custom, Mage_Adminhtml_Model_System_Config_Backend_Admin_Usecustom, Mage_Adminhtml_Model_System_Config_Backend_Baseurl, Mage_Adminhtml_Model_System_Config_Backend_Design_Package, Mage_Adminhtml_Model_System_Config_Backend_Email_Address, Mage_Adminhtml_Model_System_Config_Backend_Email_Sender, Mage_Adminhtml_Model_System_Config_Backend_Encrypted, Mage_Adminhtml_Model_System_Config_Backend_Image, Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array, Mage_Adminhtml_Model_System_Config_Backend_Serialized, Mage_Adminhtml_Model_System_Config_Backend_Sitemap, Mage_Catalog_Model_Abstract, Mage_Catalog_Model_Entity_Attribute, Mage_Catalog_Model_Product, Mage_CatalogIndex_Model_Catalog_Index_Flag, Mage_CatalogInventory_Model_Stock_Item, Mage_Core_Model_Convert_History, Mage_Core_Model_Convert_Profile, Mage_Core_Model_Flag, Mage_Customer_Model_Address_Abstract, Mage_Customer_Model_Config_Share, Mage_Customer_Model_Customer, Mage_Dataflow_Model_Batch, Mage_Dataflow_Model_Profile_History, Mage_Dataflow_Model_Profile, Mage_Eav_Model_Entity_Attribute, Mage_GoogleOptimizer_Model_Code_Page, Mage_GoogleOptimizer_Model_Code_Product, Mage_Newsletter_Model_Template, Mage_Poll_Model_Poll_Vote, Mage_Reports_Model_Event, Mage_Rule_Model_Rule, Mage_Sales_Model_Order_Item, Mage_Sales_Model_Order_Shipment, Mage_Sales_Model_Order, Mage_Sales_Model_Quote_Address_Item, Mage_Sales_Model_Quote_Address_Rate, Mage_Sales_Model_Quote_Address, Mage_Sales_Model_Quote_Item_Abstract, Mage_Sales_Model_Quote_Item_Option, Mage_Sales_Model_Quote_Item, Mage_Sales_Model_Quote_Payment, Mage_Sales_Model_Quote, Mage_SalesRule_Model_Rule, Mage_Sitemap_Model_Sitemap, and Mage_Tax_Model_Calculation_Rate.
Definition at line 268 of file Abstract.php.
00269 { 00270 Mage::dispatchEvent('model_save_before', array('object'=>$this)); 00271 Mage::dispatchEvent($this->_eventPrefix.'_save_before', array($this->_eventObject=>$this)); 00272 return $this; 00273 }
_getResource | ( | ) | [protected] |
Get resource instance
Reimplemented in Mage_Bundle_Model_Price_Index, Mage_Catalog_Model_Product_Flat_Indexer, Mage_Catalog_Model_Product_Status, Mage_Catalog_Model_Product_Website, and Mage_Log_Model_Visitor_Online.
Definition at line 126 of file Abstract.php.
00127 { 00128 if (empty($this->_resourceName)) { 00129 Mage::throwException(Mage::helper('core')->__('Resource is not set')); 00130 } 00131 00132 return Mage::getResourceSingleton($this->_resourceName); 00133 }
_init | ( | $ | resourceModel | ) | [protected] |
Standard model initialization
string | $resourceModel | |
string | $idFieldName |
Definition at line 99 of file Abstract.php.
00100 { 00101 $this->_setResourceModel($resourceModel); 00102 }
_protectFromNonAdmin | ( | ) | [protected] |
Safeguard func that will check, if we are in admin area
Mage_Core_Exception |
Definition at line 335 of file Abstract.php.
00336 { 00337 if (Mage::registry('isSecureArea')) { 00338 return; 00339 } 00340 if (!Mage::app()->getStore()->isAdmin()) { 00341 Mage::throwException(Mage::helper('core')->__('Cannot complete this operation from non-admin area.')); 00342 } 00343 }
_setResourceModel | ( | $ | resourceName, | |
$ | resourceCollectionName = null | |||
) | [protected] |
Set resource names
If collection name is ommited, resource name will be used with _collection appended
string | $resourceName | |
string|null | $resourceCollectionName |
Definition at line 112 of file Abstract.php.
00113 { 00114 $this->_resourceName = $resourceName; 00115 if (is_null($resourceCollectionName)) { 00116 $resourceCollectionName = $resourceName.'_collection'; 00117 } 00118 $this->_resourceCollectionName = $resourceCollectionName; 00119 }
afterLoad | ( | ) |
Reimplemented in Mage_Core_Model_Config_Data, and Mage_Rule_Model_Rule.
Definition at line 234 of file Abstract.php.
00235 { 00236 $this->getResource()->afterLoad($this); 00237 $this->_afterLoad(); 00238 }
delete | ( | ) |
Delete object from database
Reimplemented in Mage_Admin_Model_User, Mage_Api_Model_User, Mage_Catalog_Model_Product, and Mage_Customer_Model_Address.
Definition at line 301 of file Abstract.php.
00302 { 00303 $this->_getResource()->beginTransaction(); 00304 try { 00305 $this->_beforeDelete(); 00306 $this->_getResource()->delete($this); 00307 $this->_afterDelete(); 00308 00309 $this->_getResource()->commit(); 00310 } 00311 catch (Exception $e){ 00312 $this->_getResource()->rollBack(); 00313 throw $e; 00314 } 00315 return $this; 00316 }
getCollection | ( | ) |
Reimplemented in Mage_Admin_Model_Rules, Mage_Admin_Model_User, Mage_Api_Model_Rules, and Mage_Api_Model_User.
Definition at line 203 of file Abstract.php.
00204 { 00205 return $this->getResourceCollection(); 00206 }
getEntityId | ( | ) |
Definition at line 376 of file Abstract.php.
00377 { 00378 return $this->_getData('entity_id'); 00379 }
getId | ( | ) |
Retrieve model object identifier
Reimplemented from Varien_Object.
Reimplemented in Mage_Admin_Model_User, Mage_Api_Model_User, Mage_CatalogInventory_Model_Stock, and Mage_Core_Model_Store.
Definition at line 155 of file Abstract.php.
00156 { 00157 if ($fieldName = $this->getIdFieldName()) { 00158 return $this->_getData($fieldName); 00159 } else { 00160 return $this->_getData('id'); 00161 } 00162 }
getIdFieldName | ( | ) |
Retrieve identifier field name for model
Reimplemented from Varien_Object.
Definition at line 141 of file Abstract.php.
00142 { 00143 if (!($fieldName = parent::getIdFieldName())) { 00144 $fieldName = $this->_getResource()->getIdFieldName(); 00145 $this->setIdFieldName($fieldName); 00146 } 00147 return $fieldName; 00148 }
getResource | ( | ) |
Retrieve model resource
Reimplemented in Mage_CatalogInventory_Model_Stock_Status, and Mage_Log_Model_Visitor.
Definition at line 371 of file Abstract.php.
00372 { 00373 return $this->_getResource(); 00374 }
getResourceCollection | ( | ) |
Get collection instance
Reimplemented in Mage_Catalog_Model_Abstract, Mage_Catalog_Model_Product, Mage_CatalogRule_Model_Rule, and Mage_SalesRule_Model_Rule.
Definition at line 195 of file Abstract.php.
00196 { 00197 if (empty($this->_resourceCollectionName)) { 00198 Mage::throwException(Mage::helper('core')->__('Model collection resource name is not defined')); 00199 } 00200 return Mage::getResourceModel($this->_resourceCollectionName, $this->_getResource()); 00201 }
getResourceName | ( | ) |
load | ( | $ | id, | |
$ | field = null | |||
) |
Load object data
integer | $id |
Reimplemented in Mage_Cms_Model_Page, Mage_Core_Model_Store, Mage_Core_Model_Website, Mage_Directory_Model_Currency, and Mage_Log_Model_Customer.
Definition at line 214 of file Abstract.php.
00215 { 00216 $this->_getResource()->load($this, $id, $field); 00217 $this->_afterLoad(); 00218 $this->setOrigData(); 00219 return $this; 00220 }
save | ( | ) |
Save object data
Reimplemented in Mage_Admin_Model_User, and Mage_Api_Model_User.
Definition at line 245 of file Abstract.php.
00246 { 00247 $this->_getResource()->beginTransaction(); 00248 try { 00249 $this->_beforeSave(); 00250 if ($this->_dataSaveAllowed) { 00251 $this->_getResource()->save($this); 00252 $this->_afterSave(); 00253 } 00254 $this->_getResource()->commit(); 00255 } 00256 catch (Exception $e){ 00257 $this->_getResource()->rollBack(); 00258 throw $e; 00259 } 00260 return $this; 00261 }
setId | ( | $ | id | ) |
Declare model object identifier value
mixed | $id |
Reimplemented from Varien_Object.
Definition at line 170 of file Abstract.php.
00171 { 00172 if ($this->getIdFieldName()) { 00173 $this->setData($this->getIdFieldName(), $id); 00174 } else { 00175 $this->setData('id', $id); 00176 } 00177 return $this; 00178 }
$_cacheTag = false [protected] |
Reimplemented in Mage_Catalog_Model_Category, Mage_Catalog_Model_Product, Mage_Cms_Model_Block, Mage_Core_Model_Store_Group, Mage_Core_Model_Store, Mage_Core_Model_Website, and Mage_Eav_Model_Entity_Attribute.
Definition at line 81 of file Abstract.php.
$_dataSaveAllowed = true [protected] |
Definition at line 90 of file Abstract.php.
$_eventObject = 'object' [protected] |
Reimplemented in Mage_Adminhtml_Model_System_Config_Backend_Price_Scope, Mage_Catalog_Model_Category, Mage_Catalog_Model_Entity_Attribute, Mage_Catalog_Model_Product, Mage_Core_Model_Store_Group, Mage_Core_Model_Store, Mage_Core_Model_Website, Mage_Customer_Model_Address_Abstract, Mage_Customer_Model_Customer, Mage_Customer_Model_Group, Mage_Eav_Model_Entity_Attribute, Mage_GiftRegistry_Model_Gift, Mage_Sales_Model_Order_Creditmemo_Item, Mage_Sales_Model_Order_Creditmemo, Mage_Sales_Model_Order_Invoice_Item, Mage_Sales_Model_Order_Invoice, Mage_Sales_Model_Order_Item, Mage_Sales_Model_Order_Shipment_Item, Mage_Sales_Model_Order_Shipment_Track, Mage_Sales_Model_Order_Shipment, Mage_Sales_Model_Order, Mage_Sales_Model_Quote_Item, Mage_Sales_Model_Quote_Payment, and Mage_Sales_Model_Quote.
Definition at line 51 of file Abstract.php.
$_eventPrefix = 'core_abstract' [protected] |
Reimplemented in Mage_Admin_Model_Roles, Mage_Admin_Model_User, Mage_Adminhtml_Model_System_Config_Backend_Price_Scope, Mage_Catalog_Model_Category, Mage_Catalog_Model_Entity_Attribute, Mage_Catalog_Model_Product, Mage_Cms_Model_Page, Mage_Core_Model_Store_Group, Mage_Core_Model_Store, Mage_Core_Model_Website, Mage_Customer_Model_Address_Abstract, Mage_Customer_Model_Customer, Mage_Customer_Model_Group, Mage_Eav_Model_Entity_Attribute, Mage_GiftRegistry_Model_Gift, Mage_Sales_Model_Order_Creditmemo_Item, Mage_Sales_Model_Order_Creditmemo, Mage_Sales_Model_Order_Invoice_Item, Mage_Sales_Model_Order_Invoice, Mage_Sales_Model_Order_Item, Mage_Sales_Model_Order_Shipment_Item, Mage_Sales_Model_Order_Shipment_Track, Mage_Sales_Model_Order_Shipment, Mage_Sales_Model_Order, Mage_Sales_Model_Quote_Item, Mage_Sales_Model_Quote_Payment, and Mage_Sales_Model_Quote.
Definition at line 42 of file Abstract.php.
$_resource [protected] |
Definition at line 65 of file Abstract.php.
$_resourceCollectionName [protected] |
Definition at line 72 of file Abstract.php.
$_resourceName [protected] |
Definition at line 58 of file Abstract.php.