memories/lib/Db/TimelineQueryFavorites.php

19 lines
668 B
PHP
Raw Normal View History

2022-09-12 01:33:38 +00:00
<?php
declare(strict_types=1);
namespace OCA\Memories\Db;
use OCP\DB\QueryBuilder\IQueryBuilder;
trait TimelineQueryFavorites {
public function transformFavoriteFilter(IQueryBuilder $query) {
2022-09-12 02:02:51 +00:00
// TODO: 2 is not guaranteed to be the favorites tag id
// use OCP\ITags; instead
2022-09-12 01:33:38 +00:00
$query->innerJoin('m', 'vcategory_to_object', 'c',
$query->expr()->andX(
$query->expr()->eq('c.objid', 'm.fileid'),
$query->expr()->eq('c.categoryid', $query->createNamedParameter(2, IQueryBuilder::PARAM_INT)),
$query->expr()->eq('c.type', $query->createNamedParameter('files')),
));
}
}