Re: Database includes
| From: | Richard Lynch | Date: | Mon, 27 Aug 2007 04:20:24 +0000 |
| Subject: | Re: Database includes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261349@lists.php.net to get a copy of this message | ||
On Sun, August 26, 2007 9:16 pm, Bruce Cowin wrote:
> I'm curious as to how everyone organises and includes their classes in
> PHP5. Let's take a simple example that has 3 classes: customer,
> order,
> and database. The database class has a base sql db class (I know
> there
> is PDO and other things but this class is already written and working)
> and classes that inherit from the base class for dev, test, and prod,
> passing the associated logins. The customer and order will both use
> the
> appropriate database class depending on which environment its in
> (e.g.,
> SalesDevDB, SalesTestDB, SalesProdDB).
I personally wouldn't make up a whole new class just to pass in a
different username/password/host/database...
> I don't want to have to go into the customer and order class code and
> change which db class it uses when I move it from dev to test and from
> test to prod. What's the proper way to handle this? Or am I way off
> base?
Once you don't have sub-classes for the 3 environments, you don't
change anything in the customer nor order class.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?