[dev] best coding practices with Horde_Views

Sebastian Birnbach birnbacs at gmail.com
Sun Sep 18 15:10:13 UTC 2016


In a PHP file that is subject to Horde_Form_Renderer->render() I whish to
perform an Rdo query. This seems impossible as there is no $injector
variable. This is the code I use successfully in the mother file and that
fails in the daughter file:

    $adapter = $injector->getInstance('Horde_Db_Adapter');
    $factory = new Horde_Rdo_Factory($adapter);
    $mapper = $factory->create('Abakus_Entity_DossierMapper');
    $q = new Horde_Rdo_Query($mapper);
    $q->sortby('ourref')
      ->limit(8)
      ->addTest('ourref', '=', Horde_Util::getFormData('search_id'));
    $results = $mapper->find($q);

The plan is to select one result, query for more fields of that result and
format output those fields formatted. To make this reusable I seek to keep
the query code in the PHP file that formats the output.

So I tried to redirect from the first PHP file to another page so I could
perform the query there. However, the redirection is giving me a headache,
the obvious approaches do not work:

(A)        Horde::url('heise.de')->redirect();
(B)        $url = new Horde_Url('heise.de');
             $url->redirect();

The page output is blank every time.

Any clues?

  Sebastian


More information about the dev mailing list