Mage_Customer_Model_Entity_Address Class Reference

Inheritance diagram for Mage_Customer_Model_Entity_Address:

Mage_Eav_Model_Entity_Abstract Mage_Core_Model_Resource_Abstract Mage_Eav_Model_Entity_Interface

List of all members.

Public Member Functions

 __construct ()
 getCustomerId ($object)
 setCustomerId ($object, $id)

Protected Member Functions

 _afterSave (Varien_Object $address)


Detailed Description

Definition at line 34 of file Address.php.


Constructor & Destructor Documentation

__construct (  ) 

Reimplemented from Mage_Core_Model_Resource_Abstract.

Definition at line 36 of file Address.php.

00037     {
00038         $resource = Mage::getSingleton('core/resource');
00039         $this->setType('customer_address')->setConnection(
00040             $resource->getConnection('customer_read'),
00041             $resource->getConnection('customer_write')
00042         );
00043     }


Member Function Documentation

_afterSave ( Varien_Object object  )  [protected]

After Save Entity process

Parameters:
Varien_Object $object

Reimplemented from Mage_Eav_Model_Entity_Abstract.

Definition at line 45 of file Address.php.

00046     {
00047         if ($address->getId() && ($address->getIsDefaultBilling() || $address->getIsDefaultShipping())) {
00048             $customer = Mage::getModel('customer/customer')
00049                 ->load($address->getCustomerId());
00050 
00051             if ($address->getIsDefaultBilling()) {
00052                 $customer->setDefaultBilling($address->getId());
00053             }
00054             if ($address->getIsDefaultShipping()) {
00055                 $customer->setDefaultShipping($address->getId());
00056             }
00057             $customer->save();
00058         }
00059         return $this;
00060     }

getCustomerId ( object  ) 

Definition at line 62 of file Address.php.

00063     {
00064         return $object->getData('customer_id') ? $object->getData('customer_id') :$object->getParentId();
00065     }

setCustomerId ( object,
id 
)

Definition at line 67 of file Address.php.

00068     {
00069         $object->setParentId($id);
00070         $object->setData('customer_id', $id);
00071         return $object;
00072     }


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