\OCP\SystemTagISystemTagObjectMapper

Public interface to access and manage system-wide tags.

Summary

Methods
Constants
getTagIdsForObjects()
getObjectIdsForTags()
assignTags()
unassignTags()
haveTag()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

getTagIdsForObjects()

getTagIdsForObjects(string|array  $objIds, string  $objectType) : array

Get a list of tag ids for the given object ids.

This returns an array that maps object id to tag ids [ 1 => array('id1', 'id2'), 2 => array('id3', 'id2'), 3 => array('id5'), 4 => array() ]

Untagged objects will have an empty array associated.

Parameters

string|array $objIds

object ids

string $objectType

object type

Returns

array —

with object id as key and an array of tag ids as value

getObjectIdsForTags()

getObjectIdsForTags(string|array  $tagIds, string  $objectType, integer  $limit, string  $offset = '') : array<mixed,string>

Get a list of objects tagged with $tagIds.

Parameters

string|array $tagIds

Tag id or array of tag ids.

string $objectType

object type

integer $limit

Count of object ids you want to get

string $offset

The last object id you already received

Throws

\OCP\SystemTag\TagNotFoundException

if at least one of the given tags does not exist

\InvalidArgumentException

When a limit is specified together with multiple tag ids

Returns

array<mixed,string> —

array of object ids or empty array if none found

assignTags()

assignTags(string  $objId, string  $objectType, string|array  $tagIds) 

Assign the given tags to the given object.

If at least one of the given tag ids doesn't exist, none of the tags will be assigned.

If the relationship already existed, fail silently.

Parameters

string $objId

object id

string $objectType

object type

string|array $tagIds

tag id or array of tag ids to assign

Throws

\OCP\SystemTag\TagNotFoundException

if at least one of the given tags does not exist

unassignTags()

unassignTags(string  $objId, string  $objectType, string|array  $tagIds) 

Unassign the given tags from the given object.

If at least one of the given tag ids doesn't exist, none of the tags will be unassigned.

If the relationship did not exist in the first place, fail silently.

Parameters

string $objId

object id

string $objectType

object type

string|array $tagIds

tag id or array of tag ids to unassign

Throws

\OCP\SystemTag\TagNotFoundException

if at least one of the given tags does not exist

haveTag()

haveTag(string|array  $objIds, string  $objectType, string  $tagId, boolean  $all = true) : boolean

Checks whether the given objects have the given tag.

Parameters

string|array $objIds

object ids

string $objectType

object type

string $tagId

tag id to check

boolean $all

true to check that ALL objects have the tag assigned, false to check that at least ONE object has the tag.

Throws

\OCP\SystemTag\TagNotFoundException

if the tag does not exist

Returns

boolean —

true if the condition set by $all is matched, false otherwise