You are here

public function UcAddressesSchemaAddress::__construct in Ubercart Addresses 7

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

Construct a schema address.

@access public

Parameters

object $schemaAddress: The schema address array to wrap. If null, a new stdClass object is created.

Return value

void

1 call to UcAddressesSchemaAddress::__construct()
UcAddressesAddress::__construct in class/UcAddressesAddress.class.php
UcAddressesAddress object constructor.
1 method overrides UcAddressesSchemaAddress::__construct()
UcAddressesAddress::__construct in class/UcAddressesAddress.class.php
UcAddressesAddress object constructor.

File

class/UcAddressesSchemaAddress.class.php, line 69
Contains the UcAddressesSchemaAddress class.

Class

UcAddressesSchemaAddress
The schema address class.

Code

public function __construct($schemaAddress = NULL) {
  $this->schemaAddress = new stdClass();
  if (is_object($schemaAddress)) {
    $this->schemaAddress = $schemaAddress;
  }

  // Make sure all fields are present.
  $fields = self::getDefinedFields();
  foreach ($fields as $fieldName => $fielddata) {
    if (!isset($this->schemaAddress->{$fieldName})) {
      $instance = $this
        ->getHandler($fieldName);
      $this->schemaAddress->{$fieldName} = $instance
        ->getDefaultValue();
    }
  }
}