Example #1
0
 /**
  * Custom setter of increment ID if its needed
  *
  * @param \Magento\Framework\DataObject $object
  * @return $this
  */
 public function setNewIncrementId(\Magento\Framework\DataObject $object)
 {
     if ($this->_scopeConfig->getValue(\Magento\Customer\Model\Customer::XML_PATH_GENERATE_HUMAN_FRIENDLY_ID, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) {
         parent::setNewIncrementId($object);
     }
     return $this;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 protected function _afterDelete(\Magento\Framework\DataObject $address)
 {
     if ($address->getId()) {
         $customer = $this->customerRepository->getById($address->getCustomerId());
         if ($customer->getDefaultBilling() == $address->getId()) {
             $customer->setDefaultBilling(null);
         }
         if ($customer->getDefaultShipping() == $address->getId()) {
             $customer->setDefaultShipping(null);
         }
         $this->customerRepository->save($customer);
     }
     return parent::_afterDelete($address);
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 protected function _afterDelete(\Magento\Framework\Object $address)
 {
     if ($address->getId()) {
         $customer = $this->_createCustomer()->load($address->getCustomerId());
         if ($customer->getDefaultBilling() == $address->getId()) {
             $customer->setDefaultBilling(null);
         }
         if ($customer->getDefaultShipping() == $address->getId()) {
             $customer->setDefaultShipping(null);
         }
         $customer->save();
     }
     return parent::_afterDelete($address);
 }