Added removeNonPublicDataFromArray().
authorRoland Haeder <roland@mxchange.org>
Sun, 9 Feb 2014 02:56:32 +0000 (03:56 +0100)
committerRoland Haeder <roland@mxchange.org>
Sun, 9 Feb 2014 02:56:32 +0000 (03:56 +0100)
Signed-off-by: Roland H├Ąder <roland@mxchange.org>
inc/classes/interfaces/database/backend/class_DatabaseBackend.php
inc/classes/main/database/class_BaseDatabaseBackend.php
inc/classes/main/database/databases/class_LocalFileDatabase.php

index ca67972..287cb26 100644 (file)
@@ -62,6 +62,14 @@ interface DatabaseBackend extends FrameworkDatabase {
         * @throws      SqlException    If an SQL error occurs
         */
        function queryUpdateDataSet (StoreableCriteria $dataSetInstance);
+
+       /**
+        * Removes non-public data from given array.
+        *
+        * @param       $data   An array with possible non-public data that needs to be removed.
+        * @return      $data   A cleaned up array with only public data.
+        */
+       function removeNonPublicDataFromArray (array $data);
 }
 
 // [EOF]
index 5c0d29b..07d1b33 100644 (file)
@@ -83,6 +83,14 @@ abstract class BaseDatabaseBackend extends BaseFrameworkSystem implements Databa
        protected final function resetLastException () {
                $this->lastException = NULL;
        }
+
+       /**
+        * Removes non-public data from given array.
+        *
+        * @param       $data   An array with possible non-public data that needs to be removed.
+        * @return      $data   A cleaned up array with only public data.
+        */
+       public abstract function removeNonPublicDataFromArray(array $data);
 }
 
 // [EOF]
index 445b7f8..7fd9e90 100644 (file)
@@ -596,6 +596,21 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackend {
                // Return the column
                return $primaryKey;
        }
+
+       /**
+        * Removes non-public data from given array.
+        *
+        * @param       $data   An array with possible non-public data that needs to be removed.
+        * @return      $data   A cleaned up array with only public data.
+        * @todo        Add more generic non-public data for removal
+        */
+       public function removeNonPublicDataFromArray (array $data) {
+               // Remove '__idx'
+               unset($data[$this->indexKey]);
+
+               // Return it
+               return $data;
+       }
 }
 
 // [EOF]