• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/Controller/Property/Directory/Action/SaveSettingsAction.php
  • Класс: BitrixIblockControllerPropertyDirectoryActionSaveSettingsAction
  • Вызов: SaveSettingsAction::save
private function save(int $propertyId, ?string $name, ?string $tableName, array $fields): Result
{
	$result = new Result();

	$isNewHighload = !empty($name);
	if ($isNewHighload)
	{
		$result = $this->createHighload($fields);
		if (!$result->isSuccess() || count($this->errorCollection) > 0)
		{
			return $result;
		}

		$highloadBlock = HighloadBlockTable::getById($result->getId())->fetch();
	}
	else
	{
		$highloadBlock = HighloadBlockTable::getRow([
			'filter' => [
				'=TABLE_NAME' => $tableName,
			],
		]);
	}

	if (!$highloadBlock)
	{
		$result->addError(
			new Error(Loc::getMessage('IBLOCK_CONTROLLER_PROPERTY_DIRECTION_ACTION_SAVE_ERROR_BAD_REQUEST'))
		);

		return $result;
	}

	/**
	 * @var Entity $entity
	 */
	$entity = HighloadBlockTable::compileEntity($highloadBlock);
	$result = $this->saveHighloadValues($entity, $fields, $isNewHighload);

	if ($result->isSuccess())
	{
		$result = $this->updatePropertyTable($propertyId, $highloadBlock['TABLE_NAME'], $isNewHighload);
	}

	return $result;
}