Example #1
0
 /**
  * Perform operation after save
  *
  * @param \Magento\Framework\DataObject $object
  * @return void
  */
 public function afterSave($object)
 {
     $billingAddressId = false;
     foreach ($object->getAddressesCollection() as $address) {
         if ('billing' == $address->getAddressType()) {
             $billingAddressId = $address->getId();
         }
     }
     if ($billingAddressId) {
         $object->setBillingAddressId($billingAddressId);
         $this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getAttributeCode());
     }
 }