Author: mcantelon
Date: Fri Jan 20 15:18:17 2012
New Revision: 10738

Log:
Replaced code with use of createRelation helper.

Modified:
   trunk/lib/QubitFlatfileImport.class.php

Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php     Fri Jan 20 15:16:36 2012        
(r10737)
+++ trunk/lib/QubitFlatfileImport.class.php     Fri Jan 20 15:18:17 2012        
(r10738)
@@ -993,6 +993,25 @@
   }
 
   /**
+   * Create a relation between two Qubit objects
+   *
+   * @param integer $subjectId  subject ID
+   * @param integer $objectId  object ID
+   * @param integer $typeId  relation type
+   *
+   * @return QubitRelation  created relation
+   */
+  public function createRelation($subjectId, $objectId, $typeId)
+  {
+    $relation = new QubitRelation;
+    $relation->subjectId = $subjectId;
+    $relation->objectId  = $objectId;
+    $relation->typeId    = $typeId;
+    $relation->save();
+    return $relation;
+  }
+
+  /**
    * Create a relation between a term and a Qubit object
    *
    * @param integer $objectId  object ID
@@ -1110,12 +1129,7 @@
     $this->setPropertiesFromArray($right, $options, $allowedProperties);
     $right->save();
 
-    // add relation
-    $relation = new QubitRelation;
-    $relation->subjectId = $this->object->id;
-    $relation->objectId = $right->id;
-    $relation->typeId = QubitTerm::RIGHT_ID;
-    $relation->save();
+    return $this->createRelation($this->object->id, $right->id, 
QubitTerm::RIGHT_ID);
 
     return $relation;
   }

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