Template extends Base
Interface CopyImplementer for copy entities.
Table of Contents
Constants
- TEMPLATE_COPY_ERROR = "TEMPLATE_COPY_ERROR"
Methods
- __construct() : mixed
- add() : bool
- Creates template and return template id.
- copyChildren() : Result
- Starts copying children entities.
- getChildrenIds() : array<string|int, mixed>
- Returns ids template children.
- getErrors() : array<string|int, Error>
- getFields() : array<string|int, mixed>
- Returns template fields.
- getList() : bool|CDBResult
- Returns query object.
- prepareFieldsToCopy() : array<string|int, mixed>
- Preparing data before creating a new entity.
- setExecutiveUserId() : void
- To copy on agent need user id.
- setTemplateCopier() : void
- To copy child templates needs template copier.
- setUfIgnoreList() : void
- To avoid copying specific fields, specify a list of fields to ignore.
- setUserFieldManager() : mixed
- To copy uf fields, you must pass the uf field manager.
- update() : bool
- Updates template.
- updateAttachedIdsInText() : void
- Updates identifiers who's added to text.
Constants
TEMPLATE_COPY_ERROR
public
mixed
TEMPLATE_COPY_ERROR
= "TEMPLATE_COPY_ERROR"
Methods
__construct()
public
__construct() : mixed
add()
Creates template and return template id.
public
add(Container $container, array<string|int, mixed> $fields) : bool
Parameters
- $container : Container
- $fields : array<string|int, mixed>
-
Template fields.
Return values
boolcopyChildren()
Starts copying children entities.
public
copyChildren(Container $container, int $entityId, int $copiedEntityId) : Result
Parameters
- $container : Container
- $entityId : int
-
Template id.
- $copiedEntityId : int
-
Copied template id.
Return values
ResultgetChildrenIds()
Returns ids template children.
public
getChildrenIds(int $templateId) : array<string|int, mixed>
Parameters
- $templateId : int
-
Template id.
Return values
array<string|int, mixed>getErrors()
public
getErrors() : array<string|int, Error>
Return values
array<string|int, Error>getFields()
Returns template fields.
public
getFields(Container $container, int $entityId) : array<string|int, mixed>
Parameters
- $container : Container
- $entityId : int
Return values
array<string|int, mixed> —$fields
getList()
Returns query object.
public
getList([array<string|int, mixed> $order = [] ][, array<string|int, mixed> $filter = [] ][, array<string|int, mixed> $select = [] ]) : bool|CDBResult
Parameters
- $order : array<string|int, mixed> = []
-
Order.
- $filter : array<string|int, mixed> = []
-
Filter.
- $select : array<string|int, mixed> = []
-
Select.
Return values
bool|CDBResultprepareFieldsToCopy()
Preparing data before creating a new entity.
public
prepareFieldsToCopy(Container $container, array<string|int, mixed> $fields) : array<string|int, mixed>
Parameters
- $container : Container
- $fields : array<string|int, mixed>
-
List entity fields.
Return values
array<string|int, mixed> —$fields
setExecutiveUserId()
To copy on agent need user id.
public
setExecutiveUserId(int $executiveUserId) : void
Parameters
- $executiveUserId : int
setTemplateCopier()
To copy child templates needs template copier.
public
setTemplateCopier(Template $templateCopier) : void
Parameters
- $templateCopier : Template
-
Template copier.
setUfIgnoreList()
To avoid copying specific fields, specify a list of fields to ignore.
public
setUfIgnoreList(array<string|int, mixed> $ufIgnoreList) : void
Parameters
- $ufIgnoreList : array<string|int, mixed>
-
Ignore list.
setUserFieldManager()
To copy uf fields, you must pass the uf field manager.
public
setUserFieldManager(CUserTypeManager $userTypeManager) : mixed
Parameters
- $userTypeManager : CUserTypeManager
-
Uf fields.
update()
Updates template.
public
update(int $templateId, array<string|int, mixed> $fields) : bool
Parameters
- $templateId : int
-
Template id.
- $fields : array<string|int, mixed>
-
Template fields.
Return values
boolupdateAttachedIdsInText()
Updates identifiers who's added to text.
public
updateAttachedIdsInText(int $id, array<string|int, mixed> $attachedIds, callable $auxiliaryCallback) : void
Parameters
- $id : int
-
Id of the entity whose text will be updated.
- $attachedIds : array<string|int, mixed>
- $auxiliaryCallback : callable