Allowed to set extra instance (for special cases, okay).
authorRoland Haeder <roland@mxchange.org>
Sat, 18 Apr 2015 01:39:54 +0000 (03:39 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 18 Apr 2015 01:39:54 +0000 (03:39 +0200)
Signed-off-by: Roland H├Ąder <roland@mxchange.org>
inc/classes/main/helper/class_BaseHelper.php

index 8011081..45b74bb 100644 (file)
@@ -149,6 +149,16 @@ class BaseHelper extends BaseFrameworkSystem {
                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
         *
@@ -453,13 +463,14 @@ class BaseHelper extends BaseFrameworkSystem {
 
                // Get the field value
                $fieldValue = $this->getValueInstance()->getField($fieldName);
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($fieldName.'[]='.gettype($fieldValue).'('.strlen($fieldValue).')');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($fieldName.'[]='.gettype($fieldValue).'('.strlen($fieldValue).') - BEFORE!');
 
                // Is it null?
                if ((is_null($fieldValue)) && (!is_null($this->extraInstance))) {
                        // So try the extra instance
                        $fieldValue = $this->extraInstance->getField($fieldName);
                } // END - if
+               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($fieldName.'[]='.gettype($fieldValue).'('.strlen($fieldValue).') - AFTER!');
 
                // Return it
                return $fieldValue;