$object = new myClass($name);
If I use "new" to create a new object in the application for saving to the db, then what method do I use to retrieve existing objects from the db?
Is there a standard procedure for handling truly new objects vs. getting existing ones from the db?
EDIT:
Would it be a bad idea to have a constructor that changes based on the parameter?
i.e.
__construct($param) {
if(is_numeric($param)) {
// get existing data from DB
} else {
// set name for new object
$this->name = $param;
}
}