Re: Singleton behaviour of LiveUser_Admin??
Andre Gemünd <[email protected]>
| Newsgroups | gmane.comp.php.pear.liveuser |
|---|---|
| Message-ID | <[email protected]> |
Tim Daeleman wrote: > Any idea how I can get this to work?? Again I don't want to throw > around config arrays and LU objects. I dont know if this is an issue, maybe its just to have the possibility to create different LiveUser_Admin instances (atm I can't imagine sensible cases in which you would need more than one instance, but who knows?). I suspect you're not using LiveUser as the only class in your scripts. Then maybe you have other objects which should be globally accessible. Then it could be more effective to create an own Singleton Class, which uses the same syntax for all classes, instead of being dependent on the different syntax of the singleton implementation for each object. I created my own little Singleton Class which handles the instantiation of the objects and the propagation of the references I need. The second possibility is to create a static Config-Object, with which you can easily retrieve the configuration of all parts of the application globally. I recently saw this on a few Java Applications. In the latter case you have to know the details of the instantiation (e.g. you create PEAR::DB instances with ::connect(), DB_NestedSet with ::factory(), Smarty with new, etc.). hth André