OOP Question in PHP

From: Date: Wed, 05 Jun 2002 21:32:39 +0000
Subject: OOP Question in PHP
Groups: php.general 
Request: Send a blank email to php-general+get-100812@lists.php.net to get a copy of this message
Hello. I have, what is probably a silly, question. I want to convert my existing scripts to OO - because it's the "way to go" in terms of the huge amount of functionality that they now have (and since I've never done it before it would be interesting). However I have one thing that I don't understand. My scripts manipulate documents and these documents are stored in a MySQL database. To create a new object is really easy. However, since I have lots of documents already, how do I alter one? Do I create a new document and pass the primary key as it's a variable in the $document = new Document(number); and have the constructor retrieve the appropriate data from MySQL and fill the attribute variables. Or do I do something like: $document = new Document; $document ->retrieve(number); Which is the best and most "valid" way of doing things. Cheers, Henry

« previous php.general (#100812) next »