Author: jwage
Date: 2008-08-27 02:47:26 +0100 (Wed, 27 Aug 2008)
New Revision: 4826

Modified:
   branches/1.0/lib/Doctrine/Connection/UnitOfWork.php
   branches/1.0/lib/Doctrine/Record.php
Log:
fixes #1383


Modified: branches/1.0/lib/Doctrine/Connection/UnitOfWork.php
===================================================================
--- branches/1.0/lib/Doctrine/Connection/UnitOfWork.php 2008-08-27 00:19:57 UTC 
(rev 4825)
+++ branches/1.0/lib/Doctrine/Connection/UnitOfWork.php 2008-08-27 01:47:26 UTC 
(rev 4826)
@@ -48,6 +48,8 @@
      */
     public function saveGraph(Doctrine_Record $record)
     {
+        $record->assignInheritanceValues();
+
         $conn = $this->getConnection();
 
         $state = $record->state();

Modified: branches/1.0/lib/Doctrine/Record.php
===================================================================
--- branches/1.0/lib/Doctrine/Record.php        2008-08-27 00:19:57 UTC (rev 
4825)
+++ branches/1.0/lib/Doctrine/Record.php        2008-08-27 01:47:26 UTC (rev 
4826)
@@ -450,6 +450,24 @@
     }
 
     /**
+     * Assign the inheritance column values
+     *
+     * @return void
+     */
+    public function assignInheritanceValues()
+    {
+        $map = $this->_table->inheritanceMap;
+        foreach ($map as $k => $v) {
+            $k = $this->_table->getFieldName($k);
+            $old = $this->get($k, false);
+
+            if ((string) $old !== (string) $v || $old === null) {
+                $this->set($k, $v);
+            }
+        }
+    }
+
+    /**
      * setDefaultValues
      * sets the default values for records internal data
      *
@@ -1289,17 +1307,7 @@
                     */
             }
         }
-        $map = $this->_table->inheritanceMap;
-        foreach ($map as $k => $v) {
-            $k = $this->_table->getFieldName($k);
-            $old = $this->get($k, false);
 
-            if ((string) $old !== (string) $v || $old === null) {
-                $a[$k] = $v;
-                $this->_data[$k] = $v;
-            }
-        }
-
         return $a;
     }
 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to