You are here

private function UcAddressesAddressBook::loadAll in Ubercart Addresses 6.2

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

Loads all addresses from database when they not already loaded.

@access private

Return value

void

7 calls to UcAddressesAddressBook::loadAll()
UcAddressesAddressBook::addAddress in class/UcAddressesAddressBook.class.php
Adds address to address book.
UcAddressesAddressBook::compareAddress in class/UcAddressesAddressBook.class.php
Checks if given address looks like an address already in the address book.
UcAddressesAddressBook::getAddresses in class/UcAddressesAddressBook.class.php
Returns all addresses of the user.
UcAddressesAddressBook::loadDefaults in class/UcAddressesAddressBook.class.php
Loads all addresses from database when they not already loaded.
UcAddressesAddressBook::loadOne in class/UcAddressesAddressBook.class.php
Loads a single address from the database if not already loaded.

... See full list

File

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

Class

UcAddressesAddressBook
The address book class

Code

private function loadAll() {

  // Reason to skip out early.
  if ($this->allLoaded) {
    return;
  }
  if (!$this
    ->isOwned()) {
    return;
  }

  // Update the performance hint setting.
  $this->performanceHint = self::PERF_HINT_LOAD_ALL;

  // Get all addresses for this user.
  $result = db_query("SELECT * FROM {uc_addresses} WHERE uid = %d ORDER BY created", $this->uid);
  if ($result === FALSE) {
    throw new UcAddressesDbException(t('Failed to read from database table uc_addresses'));
  }

  // Set flag that all addresses are loaded.
  $this->allLoaded = TRUE;

  // Set flag that default addresses are loaded.
  $this->defaultsLoaded = TRUE;
  $this
    ->dbResultToAddresses($result);
}