From: Chuck Hagenbuch Date: Wed, 26 Aug 2009 02:21:17 +0000 (-0400) Subject: Add table prefixes in the MANY_TO_MANY query, including using the 'through' X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=86951464117744b07c5a99931c27d4cb0db82052;p=horde.git Add table prefixes in the MANY_TO_MANY query, including using the 'through' table instead of the target table. --- diff --git a/framework/Rdo/lib/Horde/Rdo/Base.php b/framework/Rdo/lib/Horde/Rdo/Base.php index a905a1cb8..be8bfc606 100644 --- a/framework/Rdo/lib/Horde/Rdo/Base.php +++ b/framework/Rdo/lib/Horde/Rdo/Base.php @@ -130,11 +130,10 @@ abstract class Horde_Rdo_Base implements IteratorAggregate { $key = $mapper->primaryKey; $query = new Horde_Rdo_Query(); $on = isset($rel['on']) ? $rel['on'] : $m->primaryKey; - var_dump($key, array($on => new Horde_Rdo_Query_Literal($on), $key => $this->$key)); $query->addRelationship($field, array('mapper' => $mapper, 'table' => $rel['through'], 'type' => Horde_Rdo::MANY_TO_MANY, - 'query' => array($on => new Horde_Rdo_Query_Literal($on), $key => $this->$key))); + 'query' => array("$m->table.$on" => new Horde_Rdo_Query_Literal($rel['through'] . '.' . $on), $key => $this->$key))); $this->_fields[$field] = $m->find($query); break; }