You could just store the username; what you'll want to provide then is a static method in the Member class that, given the username (as a string), will return the appropriate object for that user.
static function lookupByUsername($username)
{
// ... Search the database for a member with this $username
// Return the Member if found, null otherwise
}
Incidentally, have you looked into using get() and set() yet?
public function __get($property)
{
switch($property)
{
case 'Username': return $this->username;
case 'JoinDate': return $this->joindate; // or whatever.
//...etc.
}
}
public function __set($property, $value)
{
switch($property)
{
case 'Username': $this->username = $value; break;
case 'JoinDate': $this->joindate = $value; break;
//...etc.
}
}
And then instead of writing $member->getUsername() you'd write $member->Username (not to be confused with $member->username) and instead of $member->setUsername('wibble') you'd write $member->Username = 'wibble'.