Re: Any idea how to do it right?
- From: ralphz <ralphzajac@xxxxxxxxxxxxx>
- Date: Tue, 29 Apr 2008 20:36:03 -0700
Hi Jerry.
Thanks for your reply. I was thinking about making a singleton and then use it in my classes constructor to get database object but that would mean three things.
1. I would have to hard code name of database classes (singletons) in other classes.
2. Require to configure singleton classes, at the beginning of every script, even if database connection is not used every time script is running.
3. Singletons would work as global variables so would be accessible at any time to every peace of code. PHP classes have global scope.
I was hoping for some nice method to pass database abstraction objects in constructor, but that would mean passing a lot of parameters to aggregate class.
Ralph
.
- Follow-Ups:
- Re: Any idea how to do it right?
- From: Jerry Stuckle
- Re: Any idea how to do it right?
- References:
- Any idea how to do it right?
- From: ralphz
- Re: Any idea how to do it right?
- From: Jerry Stuckle
- Any idea how to do it right?
- Prev by Date: I've been hacked, help!
- Next by Date: Re: I've been hacked, help!
- Previous by thread: Re: Any idea how to do it right?
- Next by thread: Re: Any idea how to do it right?
- Index(es):
Relevant Pages
|