Author: mcantelon
Date: Tue Jan 10 11:57:10 2012
New Revision: 10613

Log:
Made keymap lookup helper.

Modified:
   trunk/lib/QubitFlatfileImport.class.php
   trunk/lib/task/csvImportTask.class.php

Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php     Tue Jan 10 11:47:31 2012        
(r10612)
+++ trunk/lib/QubitFlatfileImport.class.php     Tue Jan 10 11:57:10 2012        
(r10613)
@@ -538,6 +538,13 @@
     return $relation;
   }
 
+  public function fetchKeymapEntryBySource($sourceId, $sourceName)
+  {
+    $query = "SELECT target_id FROM keymap WHERE source_id=? AND 
source_name=?";
+    $statement = QubitFlatfileImport::sqlQuery($query, array($sourceId, 
$sourceName));
+    return $statement->fetch(PDO::FETCH_OBJ);
+  }
+
   public function appendWithLineBreakIfNeeded($oldContent, $newContent)
   {
     return ($oldContent) ? $oldContent ."\n". $newContent : $newContent;

Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php      Tue Jan 10 11:47:31 2012        
(r10612)
+++ trunk/lib/task/csvImportTask.class.php      Tue Jan 10 11:57:10 2012        
(r10613)
@@ -238,9 +238,10 @@
         {
           $parentId = QubitInformationObject::ROOT_ID;
         } else {
-          $query = "SELECT target_id FROM keymap WHERE source_id=? AND 
source_name=?";
-          $statement = $self->sqlQuery($query, 
array($self->rowStatusVars['PARENT_ID'], $self->getStatus('sourceName')));
-          if ($mapEntry = $statement->fetch(PDO::FETCH_OBJ))
+          if ($mapEntry = $self->fetchKeymapEntryBySource(
+            $self->rowStatusVars['PARENT_ID'],
+            $self->getStatus('sourceName')
+          ))
           {
             $parentId = $mapEntry->target_id;
           } else {

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