Author: david
Date: Thu Nov 19 15:24:02 2009
New Revision: 3922

Log:
Migrate QubitActorName records to QubitOtherName.

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

Modified: trunk/lib/task/migrate/QubitMigrate108to110.class.php
==============================================================================
--- trunk/lib/task/migrate/QubitMigrate108to110.class.php       Thu Nov 19 
11:36:21 2009        (r3921)
+++ trunk/lib/task/migrate/QubitMigrate108to110.class.php       Thu Nov 19 
15:24:02 2009        (r3922)
@@ -37,7 +37,9 @@
     // Delete "stub" objects
     $this->deleteStubObjects();
 
-    // Add function taxonomies and terms
+    $this->moveActorNameToOtherName();
+
+    // Add taxonomies and terms
     $this->addIsdfFunctionTypes();
 
     // Alter table data
@@ -69,6 +71,36 @@
    *
    * @return QubitMigrate107to108 this object
    */
+  protected function moveActorNameToOtherName()
+  {
+    if (isset($this->data['QubitActorName']))
+    {
+      foreach ($this->data['QubitActorName'] as $key => $actorName)
+      {
+        $newKey = str_replace('QubitActorName', 'QubitOtherName', $key);
+        $otherNames[$newKey] = $actorName;
+
+        // Change actor_id foreign key -> object_id
+        $otherNames[$newKey]['object_id'] = $actorName['actor_id'];
+        unset($otherNames[$newKey]['actor_id']);
+      }
+
+      // Insert 'QubitOtherName' in same position in data as 'QubitActorName'
+      $insertPos = array_search('QubitActorName', array_keys($this->data));
+      QubitMigrate::array_insert($this->data, $insertPos, 
array('QubitOtherName' => $otherNames));
+
+      // Remove QubitActorName array
+      unset($this->data['QubitActorName']);
+    }
+
+    return $this;
+  }
+
+  /**
+   * Add ISDF function types to 'Function' taxonomy
+   *
+   * @return QubitMigrate107to108 this object
+   */
   protected function addIsdfFunctionTypes()
   {
     $this->data['QubitTerm']['QubitTerm_function_function'] = array(

--

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=.


Reply via email to