• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/rest/configuration/entity/field.php
  • Класс: Bitrix\Crm\Integration\Rest\Configuration\Entity\Field
  • Вызов: Field::changeDealCategory
static function changeDealCategory($data, $newId)
{
	// @todo rename to changeEntityCategory and support contacts, companies and smart processes categories

	if (is_string($data))
	{
		$data =	preg_replace(static::$regExpDealCategory, '${1}'.$newId.'${3}', $data);
	}
	elseif (is_array($data))
	{
		foreach ($data as $key => $value)
		{
			$newKey = static::changeDealCategory($key, $newId);
			if($newKey != $key)
			{
				unset($data[$key]);
			}

			$data[$newKey] = static::changeDealCategory($value, $newId);
		}
	}

	return $data;
}