• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/internals/collectableentity.php
  • Класс: BitrixSaleInternalsCollectableEntity
  • Вызов: CollectableEntity::createClone
public function createClone(SplObjectStorage $cloneEntity)
{
	if ($this->isClone() && $cloneEntity->contains($this))
	{
		return $cloneEntity[$this];
	}

	$collectableEntity = clone $this;
	$collectableEntity->isClone = true;

	/** @var InternalsFields $fields */
	if ($fields = $this->fields)
	{
		$collectableEntity->fields = $fields->createClone($cloneEntity);
	}

	if (!$cloneEntity->contains($this))
	{
		$cloneEntity[$this] = $collectableEntity;
	}

	if ($collection = $this->getCollection())
	{
		if (!$cloneEntity->contains($collection))
		{
			$cloneEntity[$collection] = $collection->createClone($cloneEntity);
		}

		if ($cloneEntity->contains($collection))
		{
			$collectableEntity->collection = $cloneEntity[$collection];
		}
	}

	return $collectableEntity;
}