Mage_Customer_Model_Entity_Group Class Reference

Inheritance diagram for Mage_Customer_Model_Entity_Group:

Mage_Core_Model_Mysql4_Abstract Mage_Core_Model_Resource_Abstract

List of all members.

Protected Member Functions

 _construct ()
 _initUniqueFields ()
 _beforeDelete (Mage_Core_Model_Abstract $group)
 _afterDelete (Mage_Core_Model_Abstract $group)


Detailed Description

Customer group resource model

Author:
Magento Core Team <core@magentocommerce.com>

Definition at line 32 of file Group.php.


Member Function Documentation

_afterDelete ( Mage_Core_Model_Abstract object  )  [protected]

Perform actions after object delete

Parameters:
Varien_Object $object

Reimplemented from Mage_Core_Model_Mysql4_Abstract.

Definition at line 61 of file Group.php.

00062     {
00063         $customerCollection = Mage::getResourceModel('customer/customer_collection')
00064             ->addAttributeToFilter('group_id', $group->getId())
00065             ->load();
00066         foreach ($customerCollection as $customer) {
00067             $defaultGroupId = Mage::getStoreConfig(Mage_Customer_Model_Group::XML_PATH_DEFAULT_ID, $customer->getStoreId());
00068             $customer->setGroupId($defaultGroupId);
00069             $customer->save();
00070         }
00071         return parent::_afterDelete($group);
00072     }

_beforeDelete ( Mage_Core_Model_Abstract object  )  [protected]

Perform actions before object delete

Parameters:
Varien_Object $object

Reimplemented from Mage_Core_Model_Mysql4_Abstract.

Definition at line 53 of file Group.php.

00054     {
00055         if ($group->usesAsDefault()) {
00056             Mage::throwException(Mage::helper('customer')->__('Group "%s" can not be deleted', $group->getCode()));
00057         }
00058         return parent::_beforeDelete($group);
00059     }

_construct (  )  [protected]

Resource initialization

Reimplemented from Mage_Core_Model_Resource_Abstract.

Definition at line 34 of file Group.php.

00035     {
00036         $this->_init('customer/customer_group', 'customer_group_id');
00037     }

_initUniqueFields (  )  [protected]

Initialize unique fields

Returns:
Mage_Core_Model_Mysql4_Abstract

Reimplemented from Mage_Core_Model_Mysql4_Abstract.

Definition at line 44 of file Group.php.

00045     {
00046         $this->_uniqueFields = array(array(
00047             'field' => 'customer_group_code',
00048             'title' => Mage::helper('customer')->__('Customer Group')
00049         ));
00050         return $this;
00051     }


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

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