Author: mcantelon
Date: Tue Jan 17 16:33:49 2012
New Revision: 10707

Log:
Fixed helpers that get or fetch Qubit objects.

Modified:
   trunk/lib/QubitFlatfileImport.class.php

Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php     Tue Jan 17 16:23:09 2012        
(r10706)
+++ trunk/lib/QubitFlatfileImport.class.php     Tue Jan 17 16:33:49 2012        
(r10707)
@@ -731,12 +731,14 @@
    */
   public function createOrFetchActor($name, $history = false)
   {
-    $query = "SELECT * FROM actor_i18n WHERE authorized_form_of_name=?";
+    $query = "SELECT id FROM actor_i18n WHERE authorized_form_of_name=?";
+
     $statement = QubitFlatfileImport::sqlQuery($query, array($name));
     $result = $statement->fetch(PDO::FETCH_OBJ);
+
     if ($result)
     {
-      return $result;
+      return QubitActor::getById($result->id);
     } else {
       return $this->createActor($name, $history);
     }
@@ -753,7 +755,7 @@
    */
   public function createOrFetchTerm($taxonomyId, $name, $culture = 'en')
   {
-    $query = "SELECT * FROM term t LEFT JOIN term_i18n ti ON t.id=ti.id \r
+    $query = "SELECT t.id FROM term t LEFT JOIN term_i18n ti ON t.id=ti.id \r
       WHERE t.taxonomy_id=? AND ti.name=? AND ti.culture=?";
     $statement = QubitFlatfileImport::sqlQuery(
       $query,
@@ -762,7 +764,7 @@
     $result = $statement->fetch(PDO::FETCH_OBJ);
     if ($result)
     {
-      return $result;
+      return QubitTerm::getById($result->id);
     } else {
       return QubitFlatfileImport::createTerm($taxonomyId, $name, $culture);
     }

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