RE: [PHP] Suggestions for class design

From: Date: Tue, 20 Sep 2005 00:05:50 +0000
Subject: RE: [PHP] Suggestions for class design
Groups: php.general 
Request: Send a blank email to php-general+get-222709@lists.php.net to get a copy of this message
Anas Mughal <mailto:anasmughal@gmail.com> on Monday, September 19, 2005 4:02 PM said: > The simplest way to solve this problem is as follows: > > - Have your Customer class hold only attributes for a customer. This > class would only have getter and setter methods. In the Java world, > this is referred to as a JavaBean. > - Then, have a DAO class that does your data access functions. > > Here is a sample DAO class: [snip] Ahh.. I guess this is the same thing that Michael Sims suggested? > class CustomerDAO { > > > function getCustomer(..) { > ... > //return a customer > } So I return a Customer object that has the set and get methods? And does that mean I do the following? ->set_first_name() ->set_last_name() ->set_address_1() ->set_address_2() ->set_address_3() ->set_city() ->set_state() etc. Or is there a better way to handle it? > function getCustomers(..) { > ... > // return a collection of customers > } How do I return a collection of customers? Thanks, Chris.

« previous php.general (#222709) next »