return $this->content;
}
+ /**
+ * Public setter for extra instance
+ *
+ * @param $extraInstance An extra instance of FrameworkInterface to set
+ * @return void
+ */
+ public final function setExtraInstance (FrameworkInterface $extraInstance) {
+ $this->extraInstance = $extraInstance;
+ }
+
/**
* Assigns a field from the value instance with a template variable
*
* @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).')');
-
- // 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('<pre>'.print_r($this->extraInstance, TRUE).'</pre>');
+ $this->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] fieldName=' . $fieldName . ' is not set! - @TODO');
} // END - if
// Return it