noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 19/28: Data_SQL Function prefix turn an objec


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 19/28: Data_SQL Function prefix turn an object to an array but key can have a prefix
Date: Sat, 30 Nov 2019 07:51:24 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit b227bac71a8339b35b24717586692ef57fa0024c
Author: Dany De Bontridder <address@hidden>
Date:   Sun Nov 24 20:41:10 2019 +0100

    Data_SQL Function prefix turn an object to an array but key can have a 
prefix
---
 include/lib/noalyss_sql.class.php | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/lib/noalyss_sql.class.php 
b/include/lib/noalyss_sql.class.php
index 1eb466d..25edb2f 100644
--- a/include/lib/noalyss_sql.class.php
+++ b/include/lib/noalyss_sql.class.php
@@ -312,16 +312,17 @@ abstract class Noalyss_SQL extends Data_SQL
         return $this;
     }
     /**
-     * Turn an object (row) into an array
+     * Turn an object (row) into an array, and the key could be prefixed with 
$prefix
+     * @param string $prefix before the key 
      * @return array
      */
-    public function to_array()
+    public function to_array($prefix="")
     {
         $array=array();
         foreach ($this->name as $key=> $value)
         {
-            
-            $array[$key]=$this->$key;
+            $nkey=$prefix.$key;
+            $array[$nkey]=$this->$key;
         }
         return $array;
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]