[dev] Horde_Rdo_Query - composing and decomposing

Sebastian Birnbach birnbacs at gmail.com
Thu May 10 18:49:01 UTC 2018


I am working on a search form that reiterates a db query over several
results pages. Every time you press "next" you are shown the next 10
results returned by the same search. For this I basically store the search
parameters in form variables and change the search offsets on every form
submission. This went well for simple searches but has gotten a bit tedious
with more complex ones.

$mapper is my Horde_Rdo_Mapper
$q is my Horde_Rdo_Query. I create it with new Horde_Rdo_Query($mapper) and
add fields and options as required.

One seemingly elegant way would be to get the SQL search string via $string
= $q->getQuery()[0] and store it in a form variable. Later on it is easy to
take the mapper and conduct a search: $mapper->find($string). However I,
need to manipulate the offset fields in the query before find() is called.
Plus the actual search string is an extra argument to the search and seems
not available this way.

Is there a good way to turn a SQL query string back into a Horde_Rdo_Query?


More information about the dev mailing list