Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
workflowtemplate.php
1<?php
2namespace Bitrix\Bizproc\Copy;
3
8
9class WorkflowTemplate implements Copyable
10{
11 private $implementer;
12 private $implementerName;
13
14 private $result;
15
16 public function __construct(Implementer $implementer)
17 {
18 $this->implementer = $implementer;
19 $this->implementerName = get_class($implementer);
20
21 $this->result = new Result();
22 }
23
30 public function copy(ContainerCollection $containerCollection)
31 {
32 $result = [$this->implementerName => []];
33
34 foreach ($containerCollection as $container)
35 {
36 $workflowTemplateId = $container->getEntityId();
37
38 $fields = $this->implementer->getFields($workflowTemplateId);
39
40 $fields = $this->implementer->prepareFieldsToCopy($fields);
41
42 $copiedWorkflowTemplateId = $this->implementer->add($fields);
43
44 $result[$this->implementerName][$workflowTemplateId] = $copiedWorkflowTemplateId;
45 }
46
47 $this->result->setData($result);
48
49 return $this->result;
50 }
51}
__construct(Implementer $implementer)
copy(ContainerCollection $containerCollection)