1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
workflow.php
См. документацию.
1<?php
2namespace Bitrix\Iblock\Copy\Implement\Children;
3
4use Bitrix\Bizproc\Copy\Implement\WorkflowTemplate as WorkflowTemplateImplementer;
5use Bitrix\Bizproc\Copy\Integration\Helper as BizprocHelper;
6use Bitrix\Bizproc\Copy\WorkflowTemplate as WorkflowTemplateCopier;
7use Bitrix\Main\Copy\Container;
8use Bitrix\Main\Copy\ContainerCollection;
9use Bitrix\Main\Result;
10
11class Workflow implements Child
12{
13 protected $iblockTypeId;
14
15 private $result;
16
17 public function __construct($iblockTypeId)
18 {
19 $this->iblockTypeId = $iblockTypeId;
20
21 $this->result = new Result();
22 }
23
30 public function copy($iblockId, $copiedIblockId): Result
31 {
32 $documentType = $this->getDocumentType($iblockId);
33 $newDocumentType = $this->getDocumentType($copiedIblockId);
34
35 $bizprocHelper = new BizprocHelper($documentType);
36 $templateIdsToCopy = $bizprocHelper->getWorkflowTemplateIds();
37
38 $implementer = $this->getImplementer($newDocumentType);
39 $copier = $this->getCopier($implementer);
40 $this->result = $copier->copy($this->getContainerCollection($templateIdsToCopy));
41
42 return $this->result;
43 }
44
45 protected function getDocumentType(int $iblockId): array
46 {
47 return ["iblock", \CIBlockDocument::class, "iblock_".$iblockId];
48 }
49
50 private function getImplementer(array $documentType)
51 {
52 return new WorkflowTemplateImplementer($documentType);
53 }
54
55 private function getCopier(WorkflowTemplateImplementer $implementer)
56 {
57 return new WorkflowTemplateCopier($implementer);
58 }
59
60 private function getContainerCollection(array $templateIdsToCopy)
61 {
62 $containerCollection = new ContainerCollection();
63
64 foreach ($templateIdsToCopy as $templateId)
65 {
66 $containerCollection[] = new Container($templateId);
67 }
68
69 return $containerCollection;
70 }
71}
copy($iblockId, $copiedIblockId)
Определения workflow.php:30
getDocumentType(int $iblockId)
Определения workflow.php:45
__construct($iblockTypeId)
Определения workflow.php:17
$templateId
Определения component_props2.php:51
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$iblockId
Определения iblock_catalog_edit.php:30