+ /**
+ * Generates an array of files or categories of a given uri-id
+ *
+ * @param int $uid
+ * @param int $type
+ * @return array
+ * @throws \Exception
+ */
+ public static function getArray(int $uid, int $type)
+ {
+ $tags = DBA::selectToArray('category-view', ['name'], ['uid' => $uid, 'type' => $type],
+ ['group_by' => ['name'], 'order' => ['name']]);
+ if (empty($tags)) {
+ return [];
+ }
+
+ return array_column($tags, 'name');
+ }
+
+ public static function existsForURIId(int $uri_id, int $uid)
+ {
+ return DBA::exists('post-category', ['uri-id' => $uri_id, 'uid' => $uid]);
+ }
+
+ /**
+ * Generates an array of files or categories of a given uri-id
+ *
+ * @param int $uri_id
+ * @param int $uid
+ * @param int $type
+ * @return array
+ * @throws \Exception
+ */
+ public static function getArrayByURIId(int $uri_id, int $uid, int $type = self::CATEGORY)
+ {
+ $tags = DBA::selectToArray('category-view', ['type', 'name'], ['uri-id' => $uri_id, 'uid' => $uid, 'type' => $type]);
+ if (empty($tags)) {
+ return [];
+ }
+
+ return array_column($tags, 'name');
+ }
+
+ /**
+ * Generates a comma separated list of files or categories
+ *
+ * @param int $uri_id
+ * @param int $uid
+ * @param int $type
+ * @return string
+ * @throws \Exception
+ */
+ public static function getCSVByURIId(int $uri_id, int $uid, int $type)
+ {
+ return implode(',', self::getArrayByURIId($uri_id, $uid, $type));
+ }
+