Changeset 3550

Show
Ignore:
Timestamp:
01/19/08 02:25:14 (18 months ago)
Author:
dbrewer
Message:

#740: fixed issue with hydrate when given an array containing null values. Previously, if you loaded a record from the database,
then something changed that record in the database, and you loaded the same record again in the same script, any values that had
been changed to null in the database would not be updated in the reloaded object.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.9/lib/Doctrine/Record.php

    r3536 r3550  
    426426    /** 
    427427     * cleanData 
     428     * leaves the $data array only with values whose key is a field inside this 
     429     * record and returns the values that were removed from $data.  Also converts 
     430     * any values of 'null' to objects of type Doctrine_Null. 
    428431     * 
    429432     * @param array $data       data array to be cleaned 
    430      * @return integer 
     433     * @return array $tmp       values cleaned from data 
    431434     */ 
    432435    public function cleanData(&$data) 
     
    438441            if (isset($tmp[$name])) { 
    439442                $data[$name] = $tmp[$name]; 
     443            } else if (array_key_exists($name, $tmp)) { 
     444                $data[$name] = self::$_null; 
    440445            } else if (!isset($this->_data[$name])) { 
    441446                $data[$name] = self::$_null;