| @@ 108-125 (lines=18) @@ | ||
| 105 | ->fetchAll($query, $bindings); |
|
| 106 | } |
|
| 107 | ||
| 108 | public function getActivePostsCountByTag($tag) |
|
| 109 | { |
|
| 110 | $query = " |
|
| 111 | SELECT COUNT(1) AS `count` |
|
| 112 | FROM `jpemeric_blog`.`post` |
|
| 113 | INNER JOIN `jpemeric_blog`.`ptlink` ON `ptlink`.`post_id` = `post`.`id` AND |
|
| 114 | `ptlink`.`tag_id` = :tag_id |
|
| 115 | WHERE `display` = :is_active"; |
|
| 116 | $bindings = [ |
|
| 117 | 'tag_id' => $tag, |
|
| 118 | 'is_active' => 1, |
|
| 119 | ]; |
|
| 120 | ||
| 121 | return $this |
|
| 122 | ->connections |
|
| 123 | ->getRead() |
|
| 124 | ->fetchValue($query, $bindings); |
|
| 125 | } |
|
| 126 | ||
| 127 | public function getActivePostsByCategory($category, $limit = null, $offset = 0) |
|
| 128 | { |
|
| @@ 149-164 (lines=16) @@ | ||
| 146 | ->fetchAll($query, $bindings); |
|
| 147 | } |
|
| 148 | ||
| 149 | public function getActivePostsCountByCategory($category) |
|
| 150 | { |
|
| 151 | $query = " |
|
| 152 | SELECT COUNT(1) AS `count` |
|
| 153 | FROM `jpemeric_blog`.`post` |
|
| 154 | WHERE `category` = :category AND `display` = :is_active"; |
|
| 155 | $bindings = [ |
|
| 156 | 'category' => $category, |
|
| 157 | 'is_active' => 1, |
|
| 158 | ]; |
|
| 159 | ||
| 160 | return $this |
|
| 161 | ->connections |
|
| 162 | ->getRead() |
|
| 163 | ->fetchValue($query, $bindings); |
|
| 164 | } |
|
| 165 | ||
| 166 | public function getActivePostsByRelatedTags($post, $limit = 4) |
|
| 167 | { |
|