Author: mcantelon
Date: Fri Apr 13 13:04:11 2012
New Revision: 11441

Log:
Removed support for qubitParentId column and added qubitParentSlug column that 
will look up parent Qubit ID based on a slug.

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

Modified: trunk/lib/task/import/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/import/csvImportTask.class.php       Fri Apr 13 12:43:52 
2012        (r11440)
+++ trunk/lib/task/import/csvImportTask.class.php       Fri Apr 13 13:04:11 
2012        (r11441)
@@ -254,7 +254,7 @@
       'variableColumns' => array(
         'legacyId',
         'parentId',
-        'qubitParentId',
+        'qubitParentSlug',
         'descriptionStatus',
         'publicationStatus',
         'levelOfDetail',
@@ -352,11 +352,25 @@
         $self->object->setPublicationStatus($pubStatusTermId);
 
         if (
-          isset($self->rowStatusVars['qubitParentId'])
-          && $self->rowStatusVars['qubitParentId']
+          isset($self->rowStatusVars['qubitParentSlug'])
+          && $self->rowStatusVars['qubitParentSlug']
         )
         {
-          $parentId = $self->rowStatusVars['qubitParentId'];
+          $query = "SELECT object_id FROM slug WHERE slug=?";
+
+          $statement = QubitFlatfileImport::sqlQuery(
+            $query,
+            array($self->rowStatusVars['qubitParentSlug'])
+          );
+
+          $result = $statement->fetch(PDO::FETCH_OBJ);
+
+          if ($result)
+          {
+            $parentId = $result->object_id;
+          } else {
+            throw new sfException('Could not find information object matching 
slug "'. $self->rowStatusVars['qubitParentSlug'] .'"');
+          }
         } else {
           if (isset($self->rowStatusVars['parentId']) && 
!$self->rowStatusVars['parentId'])
           {

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