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. ThanksPlenty 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);
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. ThanksPlenty 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);