25 private $iblockImplementer;
26 private $fieldImplementer;
27 private $workflowImplementer;
36 private $mapIdsCopiedIblock = [];
70 if (($key = array_search($feature, $this->features)) !==
false)
72 unset($this->features[$key]);
81 $this->dictionary = $dictionary;
86 $this->iblockImplementer = $implementer;
91 $this->fieldImplementer = $implementer;
96 $this->workflowImplementer = $implementer;
101 $containerCollection = $this->getContainerCollection();
103 $iblockCopier = $this->getIblockCopier();
105 $result = $iblockCopier->copy($containerCollection);
107 $this->mapIdsCopiedIblock = $iblockCopier->getMapIdsCopiedEntity();
119 return $this->mapIdsCopiedIblock;
122 private function getContainerCollection()
126 foreach ($this->iblockIdsToCopy as $iblockId)
129 if ($this->dictionary)
131 $container->setDictionary($this->dictionary);
133 $containerCollection[] = $container;
136 return $containerCollection;
139 private function getIblockCopier()
141 global $CACHE_MANAGER;
143 $iblockImplementer = ($this->iblockImplementer ? $this->iblockImplementer :
new IblockImplementer());
145 $iblockImplementer->setTargetIblockTypeId($this->targetIblockTypeId);
146 $iblockImplementer->setTargetSocnetGroupId($this->targetSocnetGroupId);
147 if (is_object($CACHE_MANAGER))
149 $iblockImplementer->setCacheManager($CACHE_MANAGER);
152 $sectionImplementer =
null;
153 if (in_array(
"field", $this->features))
155 if (!$this->fieldImplementer)
157 $this->fieldImplementer =
new FieldImplementer();
159 $iblockImplementer->setChild($this->fieldImplementer);
161 if (in_array(
"section", $this->features))
163 $sectionImplementer =
new SectionImplementer();
164 $iblockImplementer->setChild($sectionImplementer);
166 if (in_array(
"element", $this->features))
169 $iblockImplementer->setChild($elementImplementer);
171 if (in_array(
"workflow", $this->features) && Loader::includeModule(
"bizproc"))
173 if (!$this->workflowImplementer)
175 $this->workflowImplementer =
new WorkflowImplementer($this->iblockTypeId);
177 $iblockImplementer->setChild($this->workflowImplementer);
180 return new EntityCopier($iblockImplementer);