You are here

private function UcAddressesAddressBook::removeAddressFromAddressBook in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 class/UcAddressesAddressBook.class.php \UcAddressesAddressBook::removeAddressFromAddressBook()

Removes an address from this address book.

This method is called when an address is deleted or when the owner of an address is set.

@access private

Parameters

UcAddressesAddress $address: The address to remove from the address book.

Return value

void

2 calls to UcAddressesAddressBook::removeAddressFromAddressBook()
UcAddressesAddressBook::deleteOne in class/UcAddressesAddressBook.class.php
Deletes one address.
UcAddressesAddressBook::setAddressOwner in class/UcAddressesAddressBook.class.php
Sets the owner of an address if the owner was previously unknown.

File

class/UcAddressesAddressBook.class.php, line 1064
Contains the UcAddressesAddressBook class.

Class

UcAddressesAddressBook
The address book class

Code

private function removeAddressFromAddressBook($address) {
  $aid = $address
    ->getId();
  if (isset($this->addresses[$aid])) {
    unset($this->addresses[$address
      ->getId()]);
  }

  // Check default addresses array
  foreach ($this->defaultAddresses as $address_type => $defaultAddress) {
    if ($defaultAddress
      ->getId() == $aid) {
      unset($this->defaultAddresses[$address_type]);
    }
  }
}