RE: [PHP] Suggestions for class design

2005-09-20 Thread Chris W. Parker
Sorry I've been so quiet on this topic since I started it but I've basically been overwhelmed with information! :) I was hoping the answer(s) would be a lot more plain and simple than it(they) has been so I could get to implementing some things right away. But I'm afraid it's going to take me longe

Re: [PHP] Suggestions for class design

2005-09-20 Thread Jochem Maas
Hi Chris, nice thread, good questions - nice to see some real programming theory being discussed - does us all some good :-) here is my take, hth: Chris W. Parker wrote: Anas Mughal on Monday, September 19, 2005 4:02 PM said: The simplest way to solve this pro

RE: [PHP] Suggestions for class design

2005-09-19 Thread Chris W. Parker
Anas Mughal 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 r

Re: [PHP] Suggestions for class design

2005-09-19 Thread Anas Mughal
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 i

Re: [PHP] Suggestions for class design

2005-09-19 Thread M Saleh EG
>From what I understand is you need a data objects class. Use a generic class such as PEAR's DB_DataObject (http://pear.php.net/package/DB_DataObject). All you have to do is give the table name and the class for example would be in our case DB_DataObject_Customer And then querying the table wou

Re: [PHP] Suggestions for class design

2005-09-19 Thread Satyam
""Chris W. Parker"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Jay Blanchard on Monday, September 19, 2005 10:40 AM said: > [snip] > Where I get tripped up is when I realize I'll need to at some point > get more than one customer at a time and thus

RE: [PHP] Suggestions for class design

2005-09-19 Thread Chris W. Parker
Michael Sims on Monday, September 19, 2005 12:04 PM said: > Basically you're implementing DAO's (Data Access Objects), similar to > what an ORM (Object Relational Mapper) tool would do for you. [snip] Thanks for the info, and I'll check out the Propel site a little

RE: [PHP] Suggestions for class design

2005-09-19 Thread Michael Sims
Chris W. Parker wrote: > Let's take for example a class called 'Customer' that (obviously) > manipulates customers in the database. Here is a very basic Customer > class. (Data validation and the like are left out for brevity.) [snip] > Where I get tripped up is when I realize I'll need to at some

Re: [PHP] Suggestions for class design

2005-09-19 Thread Rory McKinley
Chris W. Parker wrote: >> >> class Customer >> { >> var $id; >> var $name; >> function get_customer() >> { $this->name = $customer['name']; >> } >> Where I get tripped up is when I realize I'll need to at some point get >> more than one customer at a

Re: [PHP] Suggestions for class design

2005-09-19 Thread Robert Cummings
On Mon, 2005-09-19 at 14:00, Mikey wrote: > Jay Blanchard wrote: > > >[snip] > >Well, yes I think it does, but what I'm missing is how this new object > >interacts with the original one if it does at all. And what would I call > >it? 'Multiple_Customers'? Or.. perhaps just 'Customers'! :) > > > >D

RE: [PHP] Suggestions for class design

2005-09-19 Thread Chris W. Parker
Jay Blanchard on Monday, September 19, 2005 10:53 AM said: > I think that it should be a stand alone class. The Customers class > could instantiate the needed number of Customer objects and the > methods of the Customers class could affect each Customer object. I'm

Re: [PHP] Suggestions for class design

2005-09-19 Thread Mikey
Jay Blanchard wrote: [snip] Well, yes I think it does, but what I'm missing is how this new object interacts with the original one if it does at all. And what would I call it? 'Multiple_Customers'? Or.. perhaps just 'Customers'! :) Do I extend the Customer class or is it a stand alone class? [/

RE: [PHP] Suggestions for class design

2005-09-19 Thread Jay Blanchard
[snip] Well, yes I think it does, but what I'm missing is how this new object interacts with the original one if it does at all. And what would I call it? 'Multiple_Customers'? Or.. perhaps just 'Customers'! :) Do I extend the Customer class or is it a stand alone class? [/snip] I think that it s

RE: [PHP] Suggestions for class design

2005-09-19 Thread Chris W. Parker
Jay Blanchard on Monday, September 19, 2005 10:40 AM said: > [snip] > Where I get tripped up is when I realize I'll need to at some point > get more than one customer at a time and thus I want to add a method > called 'get_customers()'. > [/snip] > Why, at any point

RE: [PHP] Suggestions for class design

2005-09-19 Thread Jay Blanchard
[snip] Where I get tripped up is when I realize I'll need to at some point get more than one customer at a time and thus I want to add a method called 'get_customers()'. [/snip] I know that you didn't ask for this, but the point needs discussing given your assertion above. Why, at any point, woul