This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
szurubooru/src/Models/SearchServices/CommentSearchService.php
2014-01-04 12:55:59 +01:00

21 lines
488 B
PHP

<?php
class CommentSearchService extends AbstractSearchService
{
public static function decorate(SqlQuery $sqlQuery, $searchQuery)
{
$sqlQuery
->from('comment')
->innerJoin('post')
->on('post_id = post.id');
$allowedSafety = PrivilegesHelper::getAllowedSafety();
if (empty($allowedSafety))
$sqlQuery->where('0');
else
$sqlQuery->where('post.safety')->in()->genSlots($allowedSafety)->put($allowedSafety);
$sqlQuery
->orderBy('comment.id')
->desc();
}
}