X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fhelper%2Fclass_BaseHelper.php;h=f0d436f0fa8bf25518f44b2559c3daeae278d651;hp=45b74bb3cf1a33d1ed7ee866f06003e73e47ded0;hb=9a2de3adcd917b49c9c5fa33095ccbc3a7032e9f;hpb=c20fc3e6a992d5fa6c511a40c04a7c801e09adf7 diff --git a/inc/classes/main/helper/class_BaseHelper.php b/inc/classes/main/helper/class_BaseHelper.php index 45b74bb3..f0d436f0 100644 --- a/inc/classes/main/helper/class_BaseHelper.php +++ b/inc/classes/main/helper/class_BaseHelper.php @@ -455,22 +455,29 @@ class BaseHelper extends BaseFrameworkSystem { * @throws NullPointerException Thrown if $valueInstance is null */ public function getValueField ($fieldName) { + // Init value + $fieldValue = NULL; + // The $valueInstance attribute should not be null! if (is_null($this->getValueInstance())) { // Throws an exception here throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); } // END - if - // Get the field value - $fieldValue = $this->getValueInstance()->getField($fieldName); - //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($fieldName.'[]='.gettype($fieldValue).'('.strlen($fieldValue).') - BEFORE!'); - - // Is it null? - if ((is_null($fieldValue)) && (!is_null($this->extraInstance))) { + // Is the field set? + if ($this->getValueInstance()->isFieldSet($fieldName)) { + // Get the field value + $fieldValue = $this->getValueInstance()->getField($fieldName); + //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($fieldName.'[]='.gettype($fieldValue).'('.strlen($fieldValue).') - Value instance!'); + } elseif ((!is_null($this->extraInstance)) && ($this->extraInstance->isFieldSet($fieldName))) { // So try the extra instance $fieldValue = $this->extraInstance->getField($fieldName); + //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($fieldName.'[]='.gettype($fieldValue).'('.strlen($fieldValue).') - Extra instance!'); + } else { + // Field is not set + if ((!is_null($this->extraInstance)) && ($fieldName == 'city_name')) die('
'.print_r($this->extraInstance, TRUE).'
'); + $this->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] fieldName=' . $fieldName . ' is not set! - @TODO'); } // END - if - //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($fieldName.'[]='.gettype($fieldValue).'('.strlen($fieldValue).') - AFTER!'); // Return it return $fieldValue;