You are here

public function UcAddressesAddressBook::getAddressById in Ubercart Addresses 7

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

Get an address by ID.

First a check is done to see if the address is already available in $addresses array. If it's not available, then a database request is send. If the requested address is not found or not owned by the user of the address book, an UcAddressesDbException is thrown.

@access public

Parameters

int $aid: The ID of the address to get.

Return value

UcAddressesAddress if the address is found. FALSE otherwise.

Throws

UcAddressesDbException

1 call to UcAddressesAddressBook::getAddressById()
UcAddressesAddressBook::deleteOne in class/UcAddressesAddressBook.class.php
Deletes one address.

File

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

Class

UcAddressesAddressBook
The address book class

Code

public function getAddressById($aid) {
  $this
    ->loadOne(self::BY_AID, $aid);
  if (isset($this->addresses[$aid])) {
    return $this->addresses[$aid];
  }
  return FALSE;
}