Click to See Complete Forum and Search --> : *sigh* More object design questions.


dougal85
01-25-2007, 11:55 PM
Ok. So lets say i have a New object.

How do i manage queries and stuff for getting multiple results?

Where would i put the method, getXNewestArticles() ?

i'm having some major issues with my object design. lol.

at the moment i have the database object and the news object.... the news object uses the database object for the methods getArticleById etc.

Any tips would be good. Thanks

ahundiak
01-27-2007, 12:25 AM
Plenty of different approaches. You might try creating an ArticleModel class with some static methods for retrieving different sets of atricles.

$newestAtricles = ArticleModel::getLatestArticles($db,$numberToGet);

$db is your data connection object.

An alternative would be to actually create an ArticleModel object.

$articleModel = new ArticleModel($db);
$newestArticles = $articleModel->getLatestArticles($numberToGet);