rdo bugfixes
authorChuck Hagenbuch <chuck@horde.org>
Sun, 11 Jan 2009 05:30:05 +0000 (00:30 -0500)
committerChuck Hagenbuch <chuck@horde.org>
Sun, 11 Jan 2009 05:30:05 +0000 (00:30 -0500)
framework/Rdo/lib/Horde/Rdo/Base.php
framework/Rdo/lib/Horde/Rdo/Mapper.php
framework/Rdo/lib/Horde/Rdo/Query.php

index 305f4c3..ccc8e7d 100644 (file)
@@ -118,7 +118,7 @@ abstract class Horde_Rdo_Base implements IteratorAggregate {
                 $query = $this->_fillPlaceholders($rel['query']);
                 $this->_fields[$field] = $m->findOne($query);
             } else {
-                $this->_fields[$field] = $m->find($this->{$rel['foreignKey']});
+                $this->_fields[$field] = $m->findOne($this->{$rel['foreignKey']});
             }
             break;
 
index dd9963a..942d530 100644 (file)
@@ -508,7 +508,7 @@ abstract class Horde_Rdo_Mapper implements Countable
         if (is_null($arg)) {
             $query = null;
         } elseif (is_scalar($arg)) {
-            $query = array($this->tableDefinition->getPrimaryKey() => $arg);
+            $query = array((string)$this->tableDefinition->getPrimaryKey() => $arg);
         } else {
             $query = $arg;
         }
index 558778c..8108a5c 100644 (file)
@@ -382,13 +382,11 @@ class Horde_Rdo_Query
             $sql .= ' ORDER BY';
             foreach ($this->sortby as $sort) {
                 if (strpos($sort, '@') !== false) {
-                    /* @TODO parse these placeholders out, or drop them */
-                    list($field, $direction) = $sort;
-                    list($rel, $field) = explode('@', $field);
+                    list($rel, $field) = explode('@', $sort);
                     if (!isset($this->relationships[$rel])) {
                         continue;
                     }
-                    $sql .= ' ' . $this->relationships[$rel]['table'] . '.' . $field . ' ' . $direction . ',';
+                    $sql .= ' ' . $this->relationships[$rel]['table'] . '.' . $field . ',';
                 } else {
                     $sql .= " $sort,";
                 }