]> git.mxchange.org Git - core.git/commitdiff
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 ca679722092f2729124ac5d431c2db479780559b..287cb267ba4f8fe22b63eeb60c4ab5c25d6cfcc6 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 5c0d29be0bfb0170226d448ce6f37493460b88a6..07d1b33bd21f9b30b6b8394e392c2c4489a2ab4b 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 445b7f8d67481fd3e4e8e73647cace9df07f8721..7fd9e90cb6d3177c66b89b665c4e75b9218c87fb 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]