You are here

public function UcAddressesSchemaAddress::setMultipleFields in Ubercart Addresses 6.2

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

Set multiple fields at once.

@access public

Parameters

array $fields: An array of fields with $fieldName => $value.

boolean $fieldsMustExist: (optional) If TRUE, every field in the array must exists. If there are fields in the array that do not exists an UcAddressInvalidFieldException will be thrown. Defaults to FALSE (no exceptions will be thrown).

Return value

void

Throws

UcAddressInvalidFieldException

File

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

Class

UcAddressesSchemaAddress
The schema address class.

Code

public function setMultipleFields($fields, $fieldsMustExist = FALSE) {
  foreach ($fields as $fieldName => $value) {
    if (!$fieldsMustExist && !self::fieldExists($fieldName)) {
      continue;
    }
    $this
      ->setField($fieldName, $value);
  }
}