private static function UcAddressesAddressBook::loadStatic in Ubercart Addresses 7
Same name and namespace in other branches
- 6.2 class/UcAddressesAddressBook.class.php \UcAddressesAddressBook::loadStatic()
Loads a single address from the database if not already loaded.
@access private
Parameters
int $aid: The id of the address.
Return value
boolean TRUE if the address has been loaded or found. FALSE otherwise.
1 call to UcAddressesAddressBook::loadStatic()
- UcAddressesAddressBook::loadAddress in class/
UcAddressesAddressBook.class.php - Looks up a single address.
File
- class/
UcAddressesAddressBook.class.php, line 929 - Contains the UcAddressesAddressBook class.
Class
- UcAddressesAddressBook
- The address book class
Code
private static function loadStatic($aid) {
// Reasons to skip out early.
// Lookup in all address books if the address is already loaded.
foreach (self::$singleton as $addressbook) {
if ($addressbook
->addressExists($aid)) {
return TRUE;
}
}
$result = db_select('uc_addresses')
->condition('aid', $aid)
->fields('uc_addresses')
->orderBy('created', 'ASC')
->execute();
// Create an object from the database record.
$obj = $result
->fetch();
if (!$obj) {
// If there is no such address record, then abort.
return FALSE;
}
// Get address book for loaded user.
$addressbook = self::get($obj->uid);
// Create UcAddressesAddress object.
$address = new UcAddressesAddress($addressbook, $obj);
// Give other modules a chance to add their fields.
module_invoke_all('uc_addresses_address_load', $address, $obj);
// Invoke entity load hook.
entity_get_controller('uc_addresses')
->invokeLoad(array(
$address,
));
return TRUE;
}