Here's a question on typical methodology.
My friend and I are pretty new to OOP/PHP5, and we're writing our first site together - something like a fairly simple CMS. Our question is about how people normally write OOP code (we'll just say in PHP5) for a page that prints out an article, or list of articles, from a database. It's not so much how to do it, but how should the database class (our own) interact with an article class?
We seem to agree that the actual query should be created and executed only by the DB class, but we don't know if this should be done from the actual page, or if people normally pass by reference the database object to the article object so it can do everything behind the scenes.
for example, if we wanted to update an article in the database:
$DB->updateArticle($Article->id,$Article->getValues());
versus
$Article->update();
(this object passes the values and invokes the DB query internally).
Any ideas and insights? They will be greatly appreciated!
Thanks in advance!
Cameron