summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Tags.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/private/Tags.php b/lib/private/Tags.php
index 3fc66c69d6c..22c6c68ba6c 100644
--- a/lib/private/Tags.php
+++ b/lib/private/Tags.php
@@ -642,6 +642,23 @@ class Tags implements ITags {
}
/**
+ * Get all users who favorited an object
+ */
+ public function getUsersFavoritingObject($objId) {
+ $entries = [];
+
+ $query = \OC::$server->getDatabaseConnection()->getQueryBuilder();
+ $query->select('uid')
+ ->from('vcategory_to_object', 'o')
+ ->innerJoin('o', 'vcategory', 'c', $query->expr()->eq('o.categoryid', 'c.id'))
+ ->where($query->expr()->eq('objid', $query->createNamedParameter($objId, IQueryBuilder::PARAM_INT)))
+ ->andWhere($query->expr()->eq('c.type', $query->createNamedParameter($this->type)))
+ ->andWhere($query->expr()->eq('c.category', $query->createNamedParameter(ITags::TAG_FAVORITE)));
+
+ return $query->execute()->fetchAll(\PDO::FETCH_COLUMN);
+ }
+
+ /**
* Creates a tag/object relation.
*
* @param int $objid The id of the object