Re: best coding practices with Horde_Views

Michael J Rubinsky <[email protected]> Sun, 18 Sep 2016 15:57:36 +0000
Newsgroups gmane.comp.horde.devel
Message-ID <20160918155736.Horde.jrt-p4cahyd9p3Xi24I83sd@h4.theupstairsroom.com>
Quoting Sebastian Birnbach <[email protected]>:

> 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?

I don't really completely follow your description of the code  
structure - and I'm not sure where you are trying to access $injector  
- but as far as "there is no $injector variable" - if this code is  
within some non-global scope, you'll need to use $GLOBALS['injector']  
(or declare the $injector variable as global).


>   Sebastian
> --
> dev mailing list
> Frequently Asked Questions: http://wiki.horde.org/FAQ
> To unsubscribe, mail: [email protected]



-- 
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject

-- 
dev mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: [email protected]
smime.p7s (application/pkcs7-signature, 2 KB) - not displayed