Documentation

Vtiger_Relation_Model extends Base
in package

Base class.

Table of Contents

RELATION_M2M  = 2
RELATION_O2M  = 1
$cachedInstances  : array<string|int, Vtiger_Relation_Model>
Cached instances.
$cachedInstancesById  : array<string|int, Vtiger_Relation_Model>
Cached instances by relation id.
$customViewList  : array<string|int, mixed>
$parentModule  : mixed
$relatedModule  : mixed
$typeRelationModel  : RelationAbstraction
$value  : array<string|int, mixed>
__construct()  : mixed
Constructor.
addRelation()  : mixed
Add relation.
addRelationTree()  : mixed
Function to add tree type relation.
deleteRelation()  : bool
Delete relation.
deleteRelationTree()  : mixed
Function to delete tree type relation.
get()  : mixed
Function to get the value for a given key.
getActions()  : array<string|int, string>
Get actions.
getAllRelations()  : array<string|int, Vtiger_Relation_Model>
Getting all relations.
getArray()  : array<string|int, mixed>
Function to get the array values for a given key.
getAutoCompleteField()  : array<string|int, mixed>
Get autocomplete fields.
getCreateViewUrl()  : string
Get create url from parent record.
getCustomView()  : array<string|int, string>
Get custom view.
getCustomViewList()  : array<string|int, string>
Get custom view list.
getData()  : array<string|int, mixed>
Function to get all the values of the Object.
getDeleteUrl()  : string
Get delete url from parent record.
getFields()  : mixed
getForHtml()  : mixed
Function to get the html encoded value for a given key.
getForSql()  : mixed
Function to get the value if its safe to use for SQL Query (column).
getId()  : int
Function returns the relation id.
getInstance()  : $this|bool
Get relation model instance.
getInstanceById()  : self|bool
Get relation model instance by relation id.
getKeys()  : array<string|int, string>
Function to get keys.
getListUrl()  : string
Get list url for record.
getParentModuleModel()  : Vtiger_Module_Model
Function that returns the relation's parent module model.
getParentRecord()  : Vtiger_Record_Model|null
Gets parent record model.
getQuery()  : QueryGenerator
Get query form relation.
getQueryFields()  : array<string|int, Vtiger_Field_Model>
Get query fields.
getQueryGenerator()  : QueryGenerator
Get query generator instance.
getReferenceTableInfo()  : mixed
getRelatedViewType()  : array<string|int, string>
Get related view type.
getRelationField()  : Vtiger_Field_Model
Function to get relation field for relation module and parent module.
getRelationFields()  : array<string|int, mixed>
Gets relation data fields.
getRelationInventoryFields()  : array<string|int, Vtiger_Basic_InventoryField>
Get relation inventory fields.
getRelationModuleModel()  : Vtiger_Module_Model
Function that returns the relation's related module model.
getRelationModuleName()  : string
Get relation module name.
getRelationTree()  : array<string|int, mixed>
Tree category relation.
getRelationTreeQuery()  : Query
Query tree category relation.
getRelationType()  : int
Get relation type.
getRestrictionsPopupField()  : mixed
getTypeRelationModel()  : RelationAbstraction
Get type relation model.
has()  : bool
Function to check if the key exists.
isActionSupported()  : bool
Check if action is supported.
isActive()  : mixed
isAddActionSupported()  : bool
Is record add action available.
isDirectRelation()  : mixed
isEditable()  : bool
Function which will specify whether the relation is editable.
isEmpty()  : bool
Function to check if the key is empty.
isFavorites()  : mixed
Check favorite.
isRelatedViewType()  : bool
Check related view type.
isSelectActionSupported()  : bool
Is record selection action available.
isTreeRelation()  : bool
Is the tree type relation available.
privilegeToDelete()  : bool
Function which will specify whether the relation is deletable.
privilegeToTreeDelete()  : bool
Function which will specify whether the tree element is deletable.
remove()  : mixed
Function to remove the value.
removeRelationById()  : mixed
Removes relation between modules.
set()  : $this
Function to set the value for a given key.
setData()  : $this
Function to set all the values.
setParentModuleModel()  : Vtiger_Relation_Model
Function sets the relation's parent module model.
setRelationConditions()  : self
Set conditions for relation fields.
setRelationModuleModel()  : $this
Set relation's parent module model.
showComment()  : bool
Show comments in related module.
showCreatorDetail()  : bool
Show user who created relation.
transfer()  : mixed
Transfer.
transferDelete()  : mixed
Delete relation.
transferTree()  : mixed
Transfer tree relation.
updateFavoriteForRecord()  : mixed
updateModuleRelatedFields()  : mixed
Update module related fields.
updateModuleRelatedInventoryFields()  : mixed
updateRelationCustomView()  : void
Function to set presence relation.
updateRelationPresence()  : mixed
Function to set presence relation.
updateRelationSequence()  : mixed
Function to save sequence of relation.
updateStateFavorites()  : mixed

Constants

RELATION_M2M

public mixed RELATION_M2M = 2

RELATION_O2M

public mixed RELATION_O2M = 1

Properties

$customViewList

protected array<string|int, mixed> $customViewList

Custom view list

$parentModule

protected mixed $parentModule = \false

$relatedModule

protected mixed $relatedModule = \false

$value

protected array<string|int, mixed> $value

Values

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $values = [] ]) : mixed
Parameters
$values : array<string|int, mixed> = []
Return values
mixed

addRelation()

Add relation.

public addRelation(int $sourceRecordId, int|array<string|int, int> $destinationRecordIds[, mixed $params = false ]) : mixed
Parameters
$sourceRecordId : int
$destinationRecordIds : int|array<string|int, int>
$params : mixed = false
Return values
mixed

addRelationTree()

Function to add tree type relation.

public addRelationTree(int $crmid, string $tree) : mixed
Parameters
$crmid : int
$tree : string
Return values
mixed

deleteRelation()

Delete relation.

public deleteRelation(int $sourceRecordId, int $relatedRecordId) : bool
Parameters
$sourceRecordId : int
$relatedRecordId : int
Return values
bool

deleteRelationTree()

Function to delete tree type relation.

public deleteRelationTree(int $crmid, string $tree) : mixed
Parameters
$crmid : int
$tree : string
Return values
mixed

get()

Function to get the value for a given key.

public get(string $key) : mixed
Parameters
$key : string
Return values
mixed

Value for the given key

getActions()

Get actions.

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

getAllRelations()

Getting all relations.

public static getAllRelations(Vtiger_Module_Model $moduleModel[, bool $selected = true ][, bool $onlyActive = true ][, bool $permissions = true ][, string $key = 'relation_id' ]) : array<string|int, Vtiger_Relation_Model>
Parameters
$moduleModel : Vtiger_Module_Model
$selected : bool = true
$onlyActive : bool = true
$permissions : bool = true
$key : string = 'relation_id'
Return values
array<string|int, Vtiger_Relation_Model>

getArray()

Function to get the array values for a given key.

public getArray(string $key[, array<string|int, mixed> $value = [] ]) : array<string|int, mixed>
Parameters
$key : string
$value : array<string|int, mixed> = []
Return values
array<string|int, mixed>

getCreateViewUrl()

Get create url from parent record.

public getCreateViewUrl([bool $fullView = false ]) : string
Parameters
$fullView : bool = false
Return values
string

getCustomView()

Get custom view.

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

getCustomViewList()

Get custom view list.

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

getData()

Function to get all the values of the Object.

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

getDeleteUrl()

Get delete url from parent record.

public getDeleteUrl(int $relatedRecordId) : string
Parameters
$relatedRecordId : int
Return values
string

getFields()

public getFields([mixed $type = false ]) : mixed
Parameters
$type : mixed = false
Return values
mixed

getForHtml()

Function to get the html encoded value for a given key.

public getForHtml(string $key) : mixed
Parameters
$key : string
Return values
mixed

getForSql()

Function to get the value if its safe to use for SQL Query (column).

public getForSql(string $key[, bool $skipEmtpy = true ]) : mixed
Parameters
$key : string
$skipEmtpy : bool = true

Skip the check if string is empty

Return values
mixed

Value for the given key

getId()

Function returns the relation id.

public getId() : int
Return values
int

getInstance()

Get relation model instance.

public static getInstance(Vtiger_Module_Model $parentModuleModel, Vtiger_Module_Model $relatedModuleModel[, bool|int $relationId = false ]) : $this|bool
Parameters
$parentModuleModel : Vtiger_Module_Model
$relatedModuleModel : Vtiger_Module_Model
$relationId : bool|int = false
Return values
$this|bool

getInstanceById()

Get relation model instance by relation id.

public static getInstanceById(int $relationId) : self|bool
Parameters
$relationId : int
Return values
self|bool

getKeys()

Function to get keys.

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

getListUrl()

Get list url for record.

public getListUrl(Vtiger_Module_Model $parentRecordModel) : string
Parameters
$parentRecordModel : Vtiger_Module_Model
Return values
string

getParentModuleModel()

Function that returns the relation's parent module model.

public getParentModuleModel() : Vtiger_Module_Model
Return values
Vtiger_Module_Model

getQueryFields()

Get query fields.

public getQueryFields() : array<string|int, Vtiger_Field_Model>
Return values
array<string|int, Vtiger_Field_Model>

with field name as key

getReferenceTableInfo()

public static getReferenceTableInfo(mixed $moduleName, mixed $refModuleName) : mixed
Parameters
$moduleName : mixed
$refModuleName : mixed
Return values
mixed

getRelatedViewType()

Get related view type.

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

getRelationField()

Function to get relation field for relation module and parent module.

public getRelationField() : Vtiger_Field_Model
Return values
Vtiger_Field_Model

getRelationFields()

Gets relation data fields.

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

getRelationModuleModel()

Function that returns the relation's related module model.

public getRelationModuleModel() : Vtiger_Module_Model
Return values
Vtiger_Module_Model

getRelationModuleName()

Get relation module name.

public getRelationModuleName() : string
Return values
string

getRelationTree()

Tree category relation.

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

getRelationTreeQuery()

Query tree category relation.

public getRelationTreeQuery() : Query
Return values
Query

getRelationType()

Get relation type.

public getRelationType() : int
Return values
int

getRestrictionsPopupField()

public getRestrictionsPopupField(mixed $recordModel) : mixed
Parameters
$recordModel : mixed
Return values
mixed

has()

Function to check if the key exists.

public has(string $key) : bool
Parameters
$key : string
Return values
bool

isActionSupported()

Check if action is supported.

public isActionSupported(string $actionName) : bool
Parameters
$actionName : string
Return values
bool

isActive()

public isActive() : mixed
Return values
mixed

isAddActionSupported()

Is record add action available.

public isAddActionSupported() : bool
Return values
bool

isDirectRelation()

public isDirectRelation() : mixed
Return values
mixed

isEditable()

Function which will specify whether the relation is editable.

public isEditable() : bool
Return values
bool

isEmpty()

Function to check if the key is empty.

public isEmpty(string $key) : bool
Parameters
$key : string
Return values
bool

isFavorites()

Check favorite.

public isFavorites() : mixed
Return values
mixed

isRelatedViewType()

Check related view type.

public isRelatedViewType(string $type) : bool
Parameters
$type : string
Return values
bool

isSelectActionSupported()

Is record selection action available.

public isSelectActionSupported() : bool
Return values
bool

isTreeRelation()

Is the tree type relation available.

public isTreeRelation() : bool
Return values
bool

privilegeToDelete()

Function which will specify whether the relation is deletable.

public privilegeToDelete([Vtiger_Record_Model|null $recordModel = null ][, int|null $recordId = null ]) : bool
Parameters
$recordModel : Vtiger_Record_Model|null = null
$recordId : int|null = null
Return values
bool

privilegeToTreeDelete()

Function which will specify whether the tree element is deletable.

public privilegeToTreeDelete() : bool
Return values
bool

remove()

Function to remove the value.

public remove(string $key) : mixed
Parameters
$key : string
Return values
mixed

removeRelationById()

Removes relation between modules.

public static removeRelationById(int $relationId) : mixed
Parameters
$relationId : int
Return values
mixed

set()

Function to set the value for a given key.

public set(string $key, mixed $value) : $this
Parameters
$key : string
$value : mixed
Return values
$this

setData()

Function to set all the values.

public setData(mixed $values) : $this
Parameters
$values : mixed
Return values
$this

setRelationConditions()

Set conditions for relation fields.

public setRelationConditions(array<string|int, mixed> $conditions) : self
Parameters
$conditions : array<string|int, mixed>
Return values
self

setRelationModuleModel()

Set relation's parent module model.

public setRelationModuleModel(Vtiger_Module_Model $relationModel) : $this
Parameters
$relationModel : Vtiger_Module_Model
Return values
$this

showComment()

Show comments in related module.

public showComment() : bool
Return values
bool

showCreatorDetail()

Show user who created relation.

public showCreatorDetail() : bool
Return values
bool

transfer()

Transfer.

public transfer(array<string|int, mixed> $recordsToTransfer) : mixed
Parameters
$recordsToTransfer : array<string|int, mixed>
Return values
mixed

transferDelete()

Delete relation.

public transferDelete(int $relId) : mixed
Parameters
$relId : int
Return values
mixed

transferTree()

Transfer tree relation.

public transferTree(array<string|int, mixed> $relationRecords) : mixed
Parameters
$relationRecords : array<string|int, mixed>
Return values
mixed

updateFavoriteForRecord()

public updateFavoriteForRecord(mixed $action, mixed $data) : mixed
Parameters
$action : mixed
$data : mixed
Return values
mixed

updateModuleRelatedFields()

Update module related fields.

public static updateModuleRelatedFields(int $relationId, array<string|int, mixed> $fields) : mixed
Parameters
$relationId : int
$fields : array<string|int, mixed>
Tags
throws
Exception
Return values
mixed

updateModuleRelatedInventoryFields()

public static updateModuleRelatedInventoryFields(mixed $relationId, mixed $fields) : mixed
Parameters
$relationId : mixed
$fields : mixed
Return values
mixed

updateRelationCustomView()

Function to set presence relation.

public static updateRelationCustomView(int $relationId, array<string|int, mixed> $customView) : void
Parameters
$relationId : int
$customView : array<string|int, mixed>
Return values
void

updateRelationPresence()

Function to set presence relation.

public static updateRelationPresence(int $relationId, string $status) : mixed
Parameters
$relationId : int
$status : string
Return values
mixed

updateRelationSequence()

Function to save sequence of relation.

public static updateRelationSequence(array<string|int, mixed> $modules) : mixed
Parameters
$modules : array<string|int, mixed>
Return values
mixed

updateStateFavorites()

public static updateStateFavorites(mixed $relationId, mixed $status) : mixed
Parameters
$relationId : mixed
$status : mixed
Return values
mixed

        

Search results