Documentation

TagsManager
in package

Class TagsManager

Tags
subpackage

Modules\Tags\Models

Table of Contents

COLUMN_ADDED_DT  = 'added_dt'
COLUMN_CREATED_DT  = 'created_dt'
COLUMN_EDITED_DT  = 'edited_dt'
COLUMN_ENTITY_NAME  = 'entity_name'
COLUMN_GROUP_NAME  = 'group_name'
COLUMN_GROUP_UUID  = 'group_uuid'
COLUMN_IS_EDITABLE  = 'is_editable'
COLUMN_LIMIT  = 'limit'
COLUMN_NAME  = 'name'
COLUMN_REQUIRED  = 'required'
COLUMN_TITLE  = 'title'
COLUMN_UUID  = 'uuid'
TAGS_GROUPS_ENTITIES_TABLE_NAME  = 'tags_groups_entities'
TAGS_GROUPS_TABLE_NAME  = 'tags_groups'
TAGS_TABLE_NAME  = 'tags'
$database  : Context
$group_props  : mixed
$primary_key  : mixed
$props  : mixed
$slugger  : mixed
$table  : mixed
$table_group  : mixed
__construct()  : mixed
add()  : array<string|int, mixed>|bool|int|iteratable<string|int, mixed>|ActiveRow|Selection|Traversable|null
Добавить тег
addGroup()  : bool
Добавляет группу тегов
addSystemTagGroups()  : bool
add not editable system tag groups in tags_groups table
addTag()  : mixed
addTagToObject()  : bool
Add tag to object by tag uuid and objectId
bindGroup()  : bool
Привязка группы тегов к сущности
createTagModuleTable()  : mixed
delete()  : bool
delete tag from the tags table
deleteAllObjectTag()  : bool
delete all object tags from the linking table
deleteGroup()  : bool
Удаляет группу тегов по имени
deleteGroups()  : bool
Удаляет группы тегов по списку имен
deleteTagFromObject()  : bool
removes tee by object id from the linking table
deleteTagModuleTable()  : mixed
find()  : Selection
find tag for params
findGroups()  : Selection
Группы тегов
findGroupsByEntity()  : mixed
findGroupsPairs()  : array<string|int, mixed>
return array tag group param as array (uuid=>title)
findPairs()  : array<string|int, mixed>
return tags as array (uuid=>title)
findSelectedTagsByGroupName()  : mixed
findTagsByGroupName()  : mixed
get()  : ActiveRow
return tag by uuid
getGroup()  : ActiveRow|null
return group by uuid
getGroupByName()  : Selection
Получить группу тегов по имени
getGroupItems()  : array<string|int, mixed>|null
return array tags by object id
getGroupUuid()  : string
return group uuid
getObjectsByTag()  : array<string|int, Row>
Ищет объекты связаные с тэгом
getPrimaryKey()  : mixed
getTableNameToObject()  : mixed
getTagByName()  : ResultSet
find tag by name and group name
getTagByTitle()  : ActiveRow|null
getTagGroupByTagUuid()  : ActiveRow|null
return tag_group by tag uuid
getTagsByGroup()  : Selection
return array tags from group name or uuid
getTagsById()  : array<string|int, mixed>|null
return array tags by object id
getTagsTitle()  : array<string|int, mixed>
return tags title in array (title=>title) by group name
injectSelection()  : mixed
registerGroup()  : mixed
Регистрация группы тегов
tagIsAssigned()  : bool
return true is tag already assigned
unbindGroup()  : mixed
unregisterGroup()  : mixed
Отмена регистрации группы тегов
update()  : mixed
updateAttachedTags()  : bool
update tags attached to object, delete old tags and add new tags
updateByEntity()  : void
Обновляет соотношения тегов у сущности
updateGroup()  : mixed
__doAction()  : string
Defines search criteria
createEntityTags()  : bool
entityTagsPrimaryKey()  : string
entityTagsTableName()  : string
generateUUID4()  : string
getGroupPropsToArray()  : array<string|int, string>
return tag group param in array
getPropsToArray()  : array<string|int, mixed>
setGroupProps()  : mixed
setProps()  : mixed
set tag param
slugify()  : string
validateUUID4()  : bool

Constants

COLUMN_ADDED_DT

public mixed COLUMN_ADDED_DT = 'added_dt'

COLUMN_CREATED_DT

public mixed COLUMN_CREATED_DT = 'created_dt'

COLUMN_EDITED_DT

public mixed COLUMN_EDITED_DT = 'edited_dt'

COLUMN_ENTITY_NAME

public mixed COLUMN_ENTITY_NAME = 'entity_name'

COLUMN_GROUP_NAME

public mixed COLUMN_GROUP_NAME = 'group_name'

COLUMN_GROUP_UUID

public mixed COLUMN_GROUP_UUID = 'group_uuid'

COLUMN_IS_EDITABLE

public mixed COLUMN_IS_EDITABLE = 'is_editable'

COLUMN_REQUIRED

public mixed COLUMN_REQUIRED = 'required'

TAGS_GROUPS_ENTITIES_TABLE_NAME

public mixed TAGS_GROUPS_ENTITIES_TABLE_NAME = 'tags_groups_entities'

TAGS_GROUPS_TABLE_NAME

public mixed TAGS_GROUPS_TABLE_NAME = 'tags_groups'

TAGS_TABLE_NAME

public mixed TAGS_TABLE_NAME = 'tags'

Properties

$group_props

private mixed $group_props = array('uuid' => '', 'title' => '', 'name' => '', 'is_editable' => '', 'created_dt' => '', 'added_dt' => '', 'edited_dt' => '')

$props

private mixed $props = array('title', 'uuid', 'name', 'group_uuid', 'created_dt', 'added_dt', 'edited_dt')

$table_group

private mixed $table_group = 'tags_groups'

Methods

__construct()

public __construct(Explorer $database) : mixed
Parameters
$database : Explorer
Return values
mixed

add()

Добавить тег

public add(string $groupUuid, string|null $name, string $title[, DateTime|null $createDate = null ]) : array<string|int, mixed>|bool|int|iteratable<string|int, mixed>|ActiveRow|Selection|Traversable|null
Parameters
$groupUuid : string

uuid or title

$name : string|null
$title : string
$createDate : DateTime|null = null
Return values
array<string|int, mixed>|bool|int|iteratable<string|int, mixed>|ActiveRow|Selection|Traversable|null

addGroup()

Добавляет группу тегов

public addGroup(string $title[, string|null $name = null ][, bool $is_editable = true ][, DateTime|null $created_dt = null ]) : bool
Parameters
$title : string

Название

$name : string|null = null

Наименование

$is_editable : bool = true

Флаг доступности редактирования пользователем

$created_dt : DateTime|null = null

Дата создания

Return values
bool

addSystemTagGroups()

add not editable system tag groups in tags_groups table

public addSystemTagGroups(array<string|int, mixed> $tagsGroups) : bool
Parameters
$tagsGroups : array<string|int, mixed>
Return values
bool

addTag()

public addTag(string $name, string $title, string $groupUuid[, mixed $createdDt = null ]) : mixed
Parameters
$name : string
$title : string
$groupUuid : string
$createdDt : mixed = null
Return values
mixed

addTagToObject()

Add tag to object by tag uuid and objectId

public addTagToObject(int $object_id, string $tag_uuid, string $module_name[, mixed $user_name = null ]) : bool
Parameters
$object_id : int
$tag_uuid : string
$module_name : string
$user_name : mixed = null
Tags
throws
TagInvalidUuid
throws
Exception
Return values
bool

bindGroup()

Привязка группы тегов к сущности

public bindGroup(string $groupName, string $entityName[, bool $required = false ][, int|null $limit = null ]) : bool
Parameters
$groupName : string

Имя группы

$entityName : string

Имя сущности

$required : bool = false

Обязательное поле в интерфейсе. По умолчанию нет.

$limit : int|null = null

Ограничение по количеству в интерфейсе. По умолчанию без ограничений.

Return values
bool

createTagModuleTable()

public createTagModuleTable(string $module_name, string $table_name) : mixed
Parameters
$module_name : string
$table_name : string
Return values
mixed

delete()

delete tag from the tags table

public delete(string $tag) : bool
Parameters
$tag : string

uuid or name

Tags
throws
TagDelFail
Return values
bool

deleteAllObjectTag()

delete all object tags from the linking table

public deleteAllObjectTag(int $object_id, string $module_name[, null $user = null ]) : bool
Parameters
$object_id : int
$module_name : string
$user : null = null
Tags
throws
TagInvalidUuid
Return values
bool

deleteGroup()

Удаляет группу тегов по имени

public deleteGroup(string $name) : bool
Parameters
$name : string

Имя

Return values
bool

deleteGroups()

Удаляет группы тегов по списку имен

public deleteGroups(array<string|int, mixed> $names) : bool
Parameters
$names : array<string|int, mixed>

Список имен

Return values
bool

deleteTagFromObject()

removes tee by object id from the linking table

public deleteTagFromObject(int $object_id, string $tag_uuid, string $module_name[, null $user = null ]) : bool
Parameters
$object_id : int
$tag_uuid : string
$module_name : string
$user : null = null
Tags
throws
NotAllPropertySetException
throws
TagInvalidUuid
Return values
bool

deleteTagModuleTable()

public deleteTagModuleTable(string $module_name) : mixed
Parameters
$module_name : string
Return values
mixed

find()

find tag for params

public find([array<string|int, mixed>|null $where = null ][, int|null $limit = null ]) : Selection
Parameters
$where : array<string|int, mixed>|null = null

array(key=>value)

$limit : int|null = null
Return values
Selection

findGroups()

Группы тегов

public findGroups() : Selection
Return values
Selection

findGroupsByEntity()

public findGroupsByEntity(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

findGroupsPairs()

return array tag group param as array (uuid=>title)

public findGroupsPairs() : array<string|int, mixed>
Return values
array<string|int, mixed>

findPairs()

return tags as array (uuid=>title)

public findPairs([null $group = null ]) : array<string|int, mixed>
Parameters
$group : null = null
Tags
throws
TagGroupNotFoundException
Return values
array<string|int, mixed>

findSelectedTagsByGroupName()

public findSelectedTagsByGroupName(string $name, string $entityName, mixed $entityId) : mixed
Parameters
$name : string
$entityName : string
$entityId : mixed
Return values
mixed

findTagsByGroupName()

public findTagsByGroupName(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

getGroupByName()

Получить группу тегов по имени

public getGroupByName(string $name) : Selection
Parameters
$name : string

Имя

Return values
Selection

getGroupItems()

return array tags by object id

public getGroupItems( $object_id,  $group_id,  $module_name) : array<string|int, mixed>|null
Parameters
$object_id :
$group_id :
$module_name :
Return values
array<string|int, mixed>|null

getObjectsByTag()

Ищет объекты связаные с тэгом

public getObjectsByTag( $tag_uuid,  $module_name) : array<string|int, Row>
Parameters
$tag_uuid :
$module_name :
Return values
array<string|int, Row>

getPrimaryKey()

public getPrimaryKey(mixed $entityTableName) : mixed
Parameters
$entityTableName : mixed
Return values
mixed

getTableNameToObject()

public static getTableNameToObject(mixed $module_name) : mixed
Parameters
$module_name : mixed
Return values
mixed

getTagByName()

find tag by name and group name

public getTagByName( $name,  $group_name) : ResultSet
Parameters
$name :
$group_name :
Return values
ResultSet

getTagByTitle()

public getTagByTitle(string $title) : ActiveRow|null
Parameters
$title : string
Return values
ActiveRow|null

getTagGroupByTagUuid()

return tag_group by tag uuid

public getTagGroupByTagUuid( $uuid) : ActiveRow|null
Parameters
$uuid :
Return values
ActiveRow|null

getTagsById()

return array tags by object id

public getTagsById( $object_id,  $module_name[, mixed $group_uuid = null ]) : array<string|int, mixed>|null
Parameters
$object_id :
$module_name :
$group_uuid : mixed = null
Return values
array<string|int, mixed>|null

getTagsTitle()

return tags title in array (title=>title) by group name

public getTagsTitle([null $group = null ]) : array<string|int, mixed>
Parameters
$group : null = null
Tags
throws
TagGroupInvalidName
throws
TagGroupNotFoundException
Return values
array<string|int, mixed>

injectSelection()

public injectSelection(Selection $selection, string $entityName) : mixed
Parameters
$selection : Selection
$entityName : string
Return values
mixed

registerGroup()

Регистрация группы тегов

public registerGroup(string $name, string $title[, bool $editable = true ][, DateTime|null $createdDt = null ]) : mixed
Parameters
$name : string

Имя

$title : string

Заголовок

$editable : bool = true

Редактируемый? По умолчанию редактируемый

$createdDt : DateTime|null = null

Дата создания

Return values
mixed

tagIsAssigned()

return true is tag already assigned

public tagIsAssigned( $object_id,  $tag_uuid,  $module_name) : bool
Parameters
$object_id :
$tag_uuid :
$module_name :
Return values
bool

unbindGroup()

public unbindGroup(string $groupName, string $entityName) : mixed
Parameters
$groupName : string
$entityName : string
Return values
mixed

unregisterGroup()

Отмена регистрации группы тегов

public unregisterGroup(string $name) : mixed
Parameters
$name : string

Имя

Return values
mixed

update()

public update(mixed $uuid, mixed $value) : mixed
Parameters
$uuid : mixed
$value : mixed
Return values
mixed

updateAttachedTags()

update tags attached to object, delete old tags and add new tags

public updateAttachedTags( $object_id,  $tags_uuid,  $module_name,  $tags_group[, null $user = null ]) : bool
Parameters
$object_id :
$tags_uuid :
$module_name :
$tags_group :
$user : null = null
Tags
throws
TagInvalidUuid
throws
TagInsertFail
Return values
bool

updateByEntity()

Обновляет соотношения тегов у сущности

public updateByEntity(string $entityName, string $entityId, ArrayHash $values) : void
Parameters
$entityName : string

Имя сущности

$entityId : string

Идентификатор сущности

$values : ArrayHash

Значения формы

Tags
throws
Exception
Return values
void

updateGroup()

public updateGroup(mixed $uuid, mixed $title) : mixed
Parameters
$uuid : mixed
$title : mixed
Return values
mixed

__doAction()

Defines search criteria

private __doAction( $tag) : string
Parameters
$tag :
Tags
throws
Exception
Return values
string

createEntityTags()

private createEntityTags(string $entityTableName, string $groupName) : bool
Parameters
$entityTableName : string
$groupName : string
Return values
bool

entityTagsPrimaryKey()

private static entityTagsPrimaryKey(string $entityName, string $primaryKeyName) : string
Parameters
$entityName : string
$primaryKeyName : string
Return values
string

entityTagsTableName()

private static entityTagsTableName(string $entityName) : string
Parameters
$entityName : string
Return values
string

generateUUID4()

private static generateUUID4() : string
Return values
string

getGroupPropsToArray()

return tag group param in array

private getGroupPropsToArray() : array<string|int, string>
Return values
array<string|int, string>

getPropsToArray()

private getPropsToArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

setGroupProps()

private setGroupProps(mixed $group_tag) : mixed
Parameters
$group_tag : mixed
Return values
mixed

setProps()

set tag param

private setProps(mixed $tag) : mixed
Parameters
$tag : mixed
Return values
mixed

slugify()

private static slugify(string $str) : string
Parameters
$str : string
Return values
string

validateUUID4()

private static validateUUID4(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

Search results