You are here

private function UcAddressesAddressBook::dbResultToAddresses in Ubercart Addresses 6.2

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

Creates UcAddressesAddress objects from a database resource.

@access private

Parameters

resource $result: Database result

Return value

void

3 calls to UcAddressesAddressBook::dbResultToAddresses()
UcAddressesAddressBook::loadAll in class/UcAddressesAddressBook.class.php
Loads all addresses from database when they not already loaded.
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.

File

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

Class

UcAddressesAddressBook
The address book class

Code

private function dbResultToAddresses($result) {

  // Create each UcAddressesAddress object from the database record.
  while ($obj = db_fetch_object($result)) {

    // Skip addresses that have already been loaded (and perhaps modified).
    if (!isset($this->addresses[$obj->aid])) {
      $address = new UcAddressesAddress($this, $obj);
      if ($address
        ->isDefault('shipping')) {
        $this->defaultAddresses['shipping'] = $address;
      }
      if ($address
        ->isDefault('billing')) {
        $this->defaultAddresses['billing'] = $address;
      }

      // Give other modules a chance to add their fields.
      module_invoke_all('uc_addresses_address_load', $address, $obj);
    }
  }
}