[horde] Help needed
Michael J Rubinsky
mrubinsk at horde.org
Fri Apr 13 19:23:48 UTC 2018
Be sure $injector is in scope, too. I.e, you may need
$GLOBALS['injector'] if you are within the scope of your object.
--
Mike
Sent from mobile
________________________________
From: Jan Schneider <jan at horde.org>
Sent: Thursday, April 12, 2018 7:47 AM
To: horde at lists.horde.org
Subject: Re: [horde] Help needed
>
> Zitat von Mike Poznecki <poz_sa at yahoo.com>:
>
>> On Wednesday, April 11, 2018, 12:07:52 PM CDT, Mike Poznecki
>> <poz_sa at yahoo.com> wrote:
>>
>>
>>
>> On Wednesday, April 11, 2018, 7:40:44 AM CDT, Ralf Lang
>> <lang at b1-systems.de> wrote:
>>
>>
>>
>>
>>
>> Am 11.04.2018 um 14:31 schrieb Mike Poznecki:
>>
>>
>>
>> On Wednesday, April 11, 2018, 6:58:33 AM CDT, Ralf Lang
>> <lang at b1-systems.de> wrote:
>>
>>
>>
>>
>>
>> Am 11.04.2018 um 13:45 schrieb Mike Poznecki:
>>
>>
>>
>> On Wednesday, April 11, 2018, 6:31:03 AM CDT, Ralf Lang
>> <lang at b1-systems.de> wrote:
>>
>>
>> Am 11.04.2018 um 13:17 schrieb Mike Poznecki:
>> > Hi, I have the following code in my new private function:
>> > global $injector, $registry;
>> > $sparams = $injector->getInstance('IMP_ Contacts')->
>> getAddressbookSearchParams();
>> >
>> > Which I copied directly from another existing Horde page. When I
>> run it, I get:
>> > PHP Fatal error: Call to a member function getInstance() on a non-object
>> > I have tried many things but cannot get this to work. Can someone
>> tell me what I am doing wrong?
>>
>> Does the app define a factory or binding for IMP_Contacts? Also, the
>> copypaste looks like there is a space between IMP_ and Contacts.
>>
>> --
>> Ralf Lang
>> Linux Consultant / Developer
>> Tel.: +49-170-6381563
>> Mail: lang at b1-systems.de
>> B1 Systems GmbH
>> Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
>> GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
>>
>> --
>> Horde mailing list
>> Frequently Asked Questions: http://horde.org/faq/
>> To unsubscribe, mail: horde-unsubscribe at lists.horde.org
>>
>> I am sure that Horde defines a factory or binding to IMP_Contacts.
>> It is used in many pages including horde/imp/lib/Contacts.php
>> Also, the space in IMP_Contacts is just a typo in my email. Thanks.
>> I doubt it's defined on the horde level, most likely it's defined
>> on the imp level
>> https://github.com/horde/imp/blob/master/lib/Application.php#L98
>>
>> Which would mean other apps cannot directly access this factory
>> binding without adding it to their own _bootstrap()
>> But the imp experts may know better.
>> --
>> Ralf Lang
>> Linux Consultant / Developer
>> Tel.: +49-170-6381563
>> Mail: lang at b1-systems.de
>> B1 Systems GmbH
>> Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
>> GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB
>> 3537 Thank you for your help. But I'm afraid that I don't know
>> what all that is. I just create a new file with a new class under
>> horde/imp/lib. The same place as a file called Contacts.php. I
>> tried to model mine after that file. But when I call $sparams =
>> $injector->getInstance('IMP_Contacts')->
>> getAddressbookSearchParams(), I get the error. I just need to be
>> able to call the database.
>> Is that custom code visible somewhere in public (github etc)?
>> Otherwise it's a little hard to guess what's the difference here.
>>
>> Regards
>>
>> Ralf
>>
>> --
>> Ralf Lang
>> Linux Consultant / Developer
>> Tel.: +49-170-6381563
>> Mail: lang at b1-systems.de
>> B1 Systems GmbH
>> Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
>> GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
>>
>>
>> Ok, I've tried everything under the sun. I cannot get access to
>> $injector in my class. I have a simple class in a simple page in
>> horde/imp/lib/. No mater what I try, when I try to do
>> $injector->getInstance(), I get "Call to a member function
>> getInstance() on a non-object" error.
>> Is there some super magic formula I need to implement in order for
>> my page to have access to the global $injector?
>>
>>
>> Anybody?
>
> Are you sure you are using the variable *after* executing
> Horde_Registry::appInit()?
>
> And please configure you mail client to do proper quoting. This
> thread is barely readable at this point.
>
> --
> Jan Schneider
> The Horde Project
> https://www.horde.org/
>
> --
> Horde mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: horde-unsubscribe at lists.horde.org
>
More information about the horde
mailing list