| Conditions | 2 |
| Paths | 2 |
| Total Lines | 41 |
| Code Lines | 32 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function getLatestArticles($limit = 20) { |
||
| 24 | $stmt = \AL\Db\execute_query( |
||
| 25 | "ArticleDAO: getLatestArticles", |
||
| 26 | $this->mysqli, |
||
| 27 | "SELECT |
||
| 28 | article_main.article_id, |
||
| 29 | article_text.article_title, |
||
| 30 | article_text.article_intro, |
||
| 31 | article_text.article_date, |
||
| 32 | users.userid |
||
| 33 | FROM |
||
| 34 | article_main |
||
| 35 | LEFT JOIN article_text ON article_text.article_id = article_main.article_id |
||
| 36 | LEFT JOIN users ON article_main.user_id = users.user_id |
||
| 37 | ORDER BY |
||
| 38 | article_date |
||
| 39 | DESC |
||
| 40 | LIMIT ?", |
||
| 41 | "i", $limit |
||
| 42 | ); |
||
| 43 | |||
| 44 | \AL\Db\bind_result( |
||
| 45 | "ArticleDAO: getLatestArticles", |
||
| 46 | $stmt, |
||
| 47 | $id, $title, $intro, $date, $user |
||
| 48 | ); |
||
| 49 | |||
| 50 | $articles = []; |
||
| 51 | while ($stmt->fetch()) { |
||
| 52 | $articles[] = new \AL\Common\Model\Article\Article( |
||
| 53 | $id, |
||
| 54 | $title, |
||
| 55 | $intro, |
||
| 56 | $date, |
||
| 57 | $user |
||
| 58 | ); |
||
| 59 | } |
||
| 60 | |||
| 61 | $stmt->close(); |
||
| 62 | |||
| 63 | return $articles; |
||
| 64 | } |
||
| 66 |