/** * Override of UcAddressesSchemaAddress::setField(). * * Prevents setting some schema fields directly. * * @param string $fieldName * The name of the field whose value we will set. * @param mixed $value * The value to which to set the field. * * @access public * @return void * @throws UcAddressInvalidFieldException */ public function setField($fieldName, $value) { switch ($fieldName) { case 'aid': // Don't set. // @todo Throw an Exception here? break; case 'uid': // Only set if the address is unowned. Else, ignore it. // @todo Throw an Exception here? if (!$this->isOwned()) { $this->setOwner($value); } break; case 'address_name': $this->setName($value); break; case 'default_shipping': if ($value) { $this->setAsDefault('shipping'); } break; case 'default_billing': if ($value) { $this->setAsDefault('billing'); } break; default: parent::setField($fieldName, $value); break; } }