So, for example:
$Account = new Account ( $databaseparms , $key );
This loads a new Account record using $databaseparms for mysqli and by searching for primary key $key.
I pass$databaseparms to the constructor, because they aren't saved with the Class definition. But maybe it would be better design to save them, or to have them inherited from a parent Class' static members, e.g. Account Extends DBObject? Not sure which is more elegant and simple design. Actually, I just thought of that second idea while writing this.
What do you think?
Also, when I load a dependent class, such as the user's inbox, I might do one of:
$Inbox = new Inbox ( $databaseparms, $Account) // let the code find the key
OR
$Inbox = new Inbox ( $databaseparms, $Account->getKey() ) // call out the key explicity.
Again, it's a slightly different question of the same type. Should the Inbox class know how to access the Account key?
Should Inbox be a member of Account, and then it can be accessed as?:
$Account.Inbox.getMessages();
I hope those questions make sense. I am a bit new to OO programming,but it sure beats procedural from a design perspective!
Thanks!