ProductPropertyFeature::updateAction

  1. Bitrix24 API (v. 23.675.0)
  2. catalog
  3. ProductPropertyFeature
  4. updateAction
  • Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/controller/productpropertyfeature.php
  • Класс: BitrixCatalogControllerProductPropertyFeature
  • Вызов: ProductPropertyFeature::updateAction
public function updateAction(int $id, array $fields): ?array
{
	$existsResult = $this->exists($id);
	if (!$existsResult->isSuccess())
	{
		$this->addErrors($existsResult->getErrors());
		return null;
	}

	$checkFieldsResult = $this->checkFieldsBeforeModify($fields);
	if (!$checkFieldsResult->isSuccess())
	{
		$this->addErrors($checkFieldsResult->getErrors());
		return null;
	}

	$propertyId = (int)$fields['PROPERTY_ID'];
	unset($fields['PROPERTY_ID']);
	$updateResult = PropertyCatalogFeature::updateFeatures($propertyId, [$fields]);
	if (!$updateResult)
	{
		$this->addErrors($updateResult->getErrors());
		return null;
	}

	return ['PRODUCT_PROPERTY_FEATURE' => $this->get($id)];
}

Добавить комментарий