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 mailto:[EMAIL PROTECTED]
on Monday, September 19, 2005 4:02 PM said:
The simplest way to solve this
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
[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,
Jay Blanchard mailto:[EMAIL PROTECTED]
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, would
[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
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?
Jay Blanchard mailto:[EMAIL PROTECTED]
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
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'! :)
Do I extend
Chris W. Parker wrote:
snip
class Customer
{
var $id;
var $name;
snip
snip
function get_customer()
{
snip
snip
$this-name = $customer['name'];
}
snip
Where I get tripped up is when I realize I'll need to at some point get
more than one customer
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
Michael Sims mailto:[EMAIL PROTECTED]
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
Chris W. Parker [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Jay Blanchard mailto:[EMAIL PROTECTED]
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
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
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
14 matches
Mail list logo