Changeset 4826

Show
Ignore:
Timestamp:
08/27/08 02:47:26 (5 months ago)
Author:
jwage
Message:

fixes #1383

Location:
branches/1.0/lib/Doctrine
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/lib/Doctrine/Connection/UnitOfWork.php

    r4720 r4826  
    4949    public function saveGraph(Doctrine_Record $record) 
    5050    { 
     51        $record->assignInheritanceValues(); 
     52 
    5153        $conn = $this->getConnection(); 
    5254 
  • branches/1.0/lib/Doctrine/Record.php

    r4819 r4826  
    447447        } else { 
    448448            return $this->getErrorStack(); 
     449        } 
     450    } 
     451 
     452    /** 
     453     * Assign the inheritance column values 
     454     * 
     455     * @return void 
     456     */ 
     457    public function assignInheritanceValues() 
     458    { 
     459        $map = $this->_table->inheritanceMap; 
     460        foreach ($map as $k => $v) { 
     461            $k = $this->_table->getFieldName($k); 
     462            $old = $this->get($k, false); 
     463 
     464            if ((string) $old !== (string) $v || $old === null) { 
     465                $this->set($k, $v); 
     466            } 
    449467        } 
    450468    } 
     
    12901308            } 
    12911309        } 
    1292         $map = $this->_table->inheritanceMap; 
    1293         foreach ($map as $k => $v) { 
    1294             $k = $this->_table->getFieldName($k); 
    1295             $old = $this->get($k, false); 
    1296  
    1297             if ((string) $old !== (string) $v || $old === null) { 
    1298                 $a[$k] = $v; 
    1299                 $this->_data[$k] = $v; 
    1300             } 
    1301         } 
    13021310 
    13031311        return $a;