Introduced new setter/getter and generic interface:
[core.git] / inc / classes / main / class_BaseFrameworkSystem.php
index c890cc23c0529f3c0109a00ed19e3c19f68da5f4..0eaddce17e5e361d872b15c72af8c3551ee0ee73 100644 (file)
@@ -128,6 +128,16 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        private $databaseInstance = null;
 
+       /**
+        * A helper instance for the form
+        */
+       private $helperInstance = null;
+
+       /**
+        * An instance of a source
+        */
+       private $sourceInstance = null;
+
        /**
         * The real class name
         */
@@ -310,6 +320,33 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $this->realClass;
        }
 
+       /**
+        * Magic function to catch setting of missing but set class fields/attributes
+        *
+        * @param       $name   Name of the field/attribute
+        * @param       $value  Value to store
+        * @return      void
+        */
+       public final function __set ($name, $value) {
+               $this->debugOutput(sprintf("Tried to set a missing field. name=%s, value[%s]=%s",
+                       $name,
+                       gettype($value),
+                       $value
+               ));
+       }
+
+       /**
+        * Magic function to catch getting of missing fields/attributes
+        *
+        * @param       $name   Name of the field/attribute
+        * @return      void
+        */
+       public final function __get ($name) {
+               $this->debugOutput(sprintf("Tried to get a missing field. name=%s",
+                       $name
+               ));
+       }
+
        /**
         * Setter for database result instance
         *
@@ -1439,6 +1476,44 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $this->socketResource;
        }
 
+       /**
+        * Setter for helper instance
+        *
+        * @param       $helperInstance         An instance of a helper class
+        * @return      void
+        */
+       protected final function setHelperInstance (Helper $helperInstance) {
+               $this->helperInstance = $helperInstance;
+       }
+
+       /**
+        * Getter for helper instance
+        *
+        * @return      $helperInstance         An instance of a helper class
+        */
+       public final function getHelperInstance () {
+               return $this->helperInstance;
+       }
+
+       /**
+        * Setter for a Sourceable instance
+        *
+        * @param       $sourceInstance The Sourceable instance
+        * @return      void
+        */
+       protected final function setSourceInstance (Sourceable $sourceInstance) {
+               $this->sourceInstance = $sourceInstance;
+       }
+
+       /**
+        * Getter for a Sourceable instance
+        *
+        * @param       $sourceInstance The Sourceable instance
+        */
+       protected final function getSourceInstance () {
+               return $this->sourceInstance;
+       }
+
        /**
         * Setter for raw package Data
         *