[dev] Horde_RDO and DISTINCT Query?
Michael Rubinsky
mike at theupstairsroom.com
Wed Sep 20 08:39:21 PDT 2006
I'm trying to construct a DISTINCT query using Horde_RDO but can't
seem to figure it out how to accomplish what I need. I'll try to give
a quick summary of what I'm trying to do -
I have two related tables - let's call them flights and aircraft. The
flights table has a field that is a foreign key into the aircraft
table. I have the relationships set up in the respective Horde_RDO
objects for flights and aircraft and simple queries return the related
data as expected. What I'm now trying to do is construct a query that
is filtered on a field on the related table - for instance, I want all
records from the flight table that contain aircraft that have a
certain value for 'aircraft_type' - which is a field in the aircraft
table.
Just using $q->addTest() with the field from joined table fails, since
when I do a $mapper->find(), the SQL statement that is build doesn't
include any of the relationships defined in the Horde_RDO objects.
I've tried building the query object, then doing
$q->addRelationship(); $mapper->storage->process();
$mapper->storage->query(), but this always tries to join the two
tables by using each table's primary key instead of foreign key =
primary key.
Can anyone point me in the right direction as to what I'm missing or
is this a limitation of Horde_RDO?
BTW, thanks to all the developers working on RDO - I LOVE the RDO model!
--
Thanks,
Mike
"Am I getting old, or has the supermarket been playing great music lately?"
More information about the dev
mailing list