Protected Member Functions | |
_construct () | |
_initUniqueFields () | |
_beforeDelete (Mage_Core_Model_Abstract $group) | |
_afterDelete (Mage_Core_Model_Abstract $group) |
Definition at line 32 of file Group.php.
_afterDelete | ( | Mage_Core_Model_Abstract $ | object | ) | [protected] |
Perform actions after object delete
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
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
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 }