[imp] accessing $notify from within a hook

Liam Hoekenga liamr at deathstar.org
Fri Jan 5 12:32:13 PST 2007


Chuck Hagenbuch wrote:
> Quoting Michael M Slusarz <slusarz at horde.org>:
>
>> This is what singletons are for.  So this should work now (and forever):
>>
>> $notify = &Notification::singleton();
>> $notify->push(_("this is a notice"), 'horde.message');
>
> This isn't actually true in this case, because the notification object 
> potentially has to have listeners attached to it, which may or may not 
> have been done (the singleton here turns out not to guarantee the 
> right things, I guess).
>
> And there still aren't guarantees about Horde 4 and beyond, so not 
> necessarily forever. :)
That said... is one approach better than the other?  
$GLOBALS['notification']  or the singleton?

Liam


More information about the imp mailing list