Author: david
Date: Fri Apr  6 14:01:56 2012
New Revision: 11417

Log:
Fix copy & paste bug that was breaking getMaterialTypeId()

Modified:
   trunk/lib/QubitSearchInformationObject.class.php

Modified: trunk/lib/QubitSearchInformationObject.class.php
==============================================================================
--- trunk/lib/QubitSearchInformationObject.class.php    Fri Apr  6 14:00:06 
2012        (r11416)
+++ trunk/lib/QubitSearchInformationObject.class.php    Fri Apr  6 14:01:56 
2012        (r11417)
@@ -964,49 +964,22 @@
 
   public function getMaterialTypeId()
   {
-    $sql  = 'SELECT term.id';
-    $sql .= ' FROM '.QubitObjectTermRelation::TABLE_NAME.' otr';
-    $sql .= ' JOIN '.QubitTerm::TABLE_NAME.' term
-                ON otr.term_id = term.id';
-    $sql .= ' WHERE object_id = ?';
-    $sql .= ' AND term.taxonomy_id = ?';
-
-    $notes = array();
-
-    // Subject relations
-    if (!isset(self::$statements['note']))
+    if (!isset(self::$statements['materialType']))
     {
-      $sql  = 'SELECT
-                  i18n.content';
-      $sql .= ' FROM '.QubitNote::TABLE_NAME.' note';
-      $sql .= ' JOIN '.QubitNoteI18n::TABLE_NAME.' i18n
-                  ON note.id = i18n.id';
-      $sql .= ' WHERE note.object_id = ?
-                  AND i18n.culture = ?';
+      $sql  = 'SELECT term.id';
+      $sql .= ' FROM '.QubitObjectTermRelation::TABLE_NAME.' otr';
+      $sql .= ' JOIN '.QubitTerm::TABLE_NAME.' term
+                  ON otr.term_id = term.id';
+      $sql .= ' WHERE object_id = ?';
+      $sql .= ' AND term.taxonomy_id = '.QubitTaxonomy::MATERIAL_TYPE_ID;
 
-      self::$statements['note'] = self::$conn->prepare($sql);
+      self::$statements['materialType'] = self::$conn->prepare($sql);
     }
 
-    self::$statements['note']->execute(array(
-      $this->__get('id'),
-      $this->__get('culture')));
-
-    foreach (self::$statements['note']->fetchAll(PDO::FETCH_OBJ) as $item)
-    {
-      if (0 < strlen($item->content))
-      {
-        $notes[] = $item->content;
-      }
-    }
-
-    if (0 < count($notes))
-    {
-      return implode(' ', $notes);
-    }
+    self::$statements['materialType']->execute(array(
+      $this->__get('id')));
 
-    return QubitPdo::fetchColumn($sql, array(
-        $this->__get('id'),
-        QubitTaxonomy::MATERIAL_TYPE_ID));
+    return self::$statements['materialType']->fetchColumn(0);
   }
 
   public function getStorageNames()

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