Skip to content

Commit

Permalink
Fixed 'column "count" does not exist' in postgres.
Browse files Browse the repository at this point in the history
  • Loading branch information
parpalak committed May 10, 2024
1 parent 51201d9 commit 14ddf26
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions _include/src/Model/TagsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ public function __construct(
) {
}


// Makes tags list for the tags page and the placeholder
/**
* Makes tags list for the tags page and the placeholder
*
* @throws \S2\Cms\Pdo\DbLayerException
*/
public function tagsList(): array
{
if ($this->cachedTags === null) {
Expand All @@ -43,17 +46,18 @@ public function tagsList(): array
$query = [
'SELECT' => 'tag_id, name, url, (' . $this->dbLayer->build($subQuery) . ') AS count',
'FROM' => 'tags AS t',
'HAVING' => 'count > 0',
'ORDER BY' => 'count DESC',
];
$result = $this->dbLayer->buildAndQuery($query);

while ($row = $this->dbLayer->fetchAssoc($result)) {
$this->cachedTags[] = array(
'title' => $row['name'],
'link' => $this->urlBuilder->link('/' . $this->tagsUrl . '/' . urlencode($row['url']) . '/'),
'num' => $row['count'],
);
if ($row['count'] > 0) {
$this->cachedTags[] = array(
'title' => $row['name'],
'link' => $this->urlBuilder->link('/' . $this->tagsUrl . '/' . urlencode($row['url']) . '/'),
'num' => $row['count'],
);
}
}
}

Expand Down

0 comments on commit 14ddf26

Please sign in to comment.