Author: david
Date: Tue Aug 23 15:23:14 2011
New Revision: 9576

Log:
Unset repository parent_id.  Fixes issue 2041.

Modified:
   trunk/lib/task/migrate/QubitMigrate110.class.php

Modified: trunk/lib/task/migrate/QubitMigrate110.class.php
==============================================================================
--- trunk/lib/task/migrate/QubitMigrate110.class.php    Tue Aug 23 15:03:27 
2011        (r9575)
+++ trunk/lib/task/migrate/QubitMigrate110.class.php    Tue Aug 23 15:23:14 
2011        (r9576)
@@ -78,6 +78,9 @@
     // Delete "stub" objects
     $this->deleteStubObjects();
 
+    // Remove repository root
+    $this->removeRepositoryRoot();
+
     return $this;
   }
 
@@ -696,6 +699,28 @@
   }
 
   /**
+   * Set repository.parent_id to null
+   *
+   * All repositories were made children of the QubitActor root object from
+   * Revision 8603 onward, but this causes a foreign key error on data-load
+   * (issue 2041)
+   *
+   * @return SELF
+   */
+  protected function removeRepositoryRoot()
+  {
+    foreach ($this->data['QubitRepository'] as $key => &$item)
+    {
+      if (isset($item['parent_id']))
+      {
+        unset($item['parent_id']);
+      }
+    }
+
+    return $this;
+  }
+
+  /**
    * Call all sort methods
    *
    * @return QubitMigrate110 this object

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" 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.com/group/qubit-commits?hl=en.

Reply via email to