You are here

private static function UCXF_Value::dbResultToValue in Extra Fields Checkout Pane 6.2

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

Creates ucxf_value objects from a database resource.

@access private

Parameters

resource $result: Database result

Return value

void

2 calls to UCXF_Value::dbResultToValue()
UCXF_Value::load in class/UCXF_Value.class.php
Loads value from database
UCXF_Value::load_list in class/UCXF_Value.class.php
Loads a list of values from database

File

class/UCXF_Value.class.php, line 379
Contains the UCXF_Value class.

Class

UCXF_Value
This class is used to keep track of all field values currently loaded.

Code

private static function dbResultToValue($result) {

  // Create each ucxf_value object from the database record
  while ($obj = db_fetch_object($result)) {
    if (isset(self::$loaded_values[$obj->element_id][$obj->element_type][$obj->field_id])) {

      // This result is already available, don't overwrite it.
      continue;
    }
    $oValue = new self();
    $oValue->element_id = $obj->element_id;
    $oValue->element_type = $obj->element_type;
    $oValue->field_id = $obj->field_id;
    $oValue->db_name = $obj->db_name;
    $oValue->value = $obj->value;
    $oValue->is_new = FALSE;

    // Cache this result
    self::$loaded_values[$obj->element_id][$obj->element_type][$obj->field_id] = $oValue;
  }
}