Re: Singleton behaviour of LiveUser_Admin??
Jens Kleikamp <lists.jens-z4600/[email protected]>
| Newsgroups | gmane.comp.php.pear.liveuser |
|---|---|
| Organization | Codes & Concepts |
| Message-ID | <[email protected]> |
Tim Daeleman wrote:
> Or maybe an init method for the LiveUser_Admin class could help me?
Hi Tim,
interesting topic.
In my opinion this question mostly depends on your application structure
or design.
I mean, where are real system objects initialized and stored ( e.g.
LiveUser) and how should "Third-Party"-Libs/Classes be handled. (e.g.
LiveUser_Admin).
Like you, i had the idea of an additionally init method for system-wide
LU_Admin Object.
A function like this worked for us:
--- Pseudo ----
function &getLU_Admin($conf = null) {
static $lu_admin;
if(!isset($lu_admin) && $conf) {
$lu_admin = LiveUser_Admin::singleton($conf);
return $lu_admin;
} elseif(is_object($lu_admin)) {
return $lu_admin;
} else {
return false;
}
}
--- Pseudo ----
Just my two cents... and sorry for the bad english :/
regards
Jens