[Solar-svn] Revision 2762

pmjones at solarphp.com pmjones at solarphp.com
Thu Sep 20 13:13:11 CDT 2007


branch: Solar_Struct: [REV] Reverting previous change so that load() uses array_merge() again.  Add special behavior to the Record class specifically, instead of to the Struct generically.



Modified: branches/orm/Solar/Struct.php
===================================================================
--- branches/orm/Solar/Struct.php	2007-09-19 02:07:20 UTC (rev 2761)
+++ branches/orm/Solar/Struct.php	2007-09-20 18:13:11 UTC (rev 2762)
@@ -172,6 +172,9 @@
      * 
      * Does a certain key exist in the data?
      * 
+     * Note that this is slightly different from normal PHP isset(); it will
+     * say the key is set, even if the key value is null or otherwise empty.
+     * 
      * @param string $key The requested data key.
      * 
      * @param mixed $val The value to set the data to.
@@ -231,19 +234,8 @@
             $data = array();
         }
         
-        // because we may have overrides in subclasses, it's not enough
-        // to just merge the data.  although slower, we need to loop and
-        // do assigns with some extra processing so that __set() is honored.
-        foreach ($data as $key => $val) {
-            $chr = substr($key, 0, 1);
-            if (ctype_alpha($chr) || $chr == '_') {
-                // valid variable name, use magic __set() on it.
-                $this->$key = $val;
-            } else {
-                // not a valid variable name, set directly in $_data.
-                $this->_data[$key] = $val;
-            }
-        }
+        // load new data, merging new values with old
+        $this->_data = array_merge($this->_data, $data);
     }
     
     /**




More information about the Solar-svn mailing list