ProductPropertyEnum::addAction

  1. Bitrix24 API (v. 23.675.0)
  2. catalog
  3. ProductPropertyEnum
  4. addAction
  • Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/controller/productpropertyenum.php
  • Класс: BitrixCatalogControllerProductPropertyEnum
  • Вызов: ProductPropertyEnum::addAction
public function addAction(array $fields): ?array
{
	$checkFieldsResult = $this->checkFieldsBeforeModify($fields);
	if (!$checkFieldsResult->isSuccess())
	{
		$this->addErrors($checkFieldsResult->getErrors());
		return null;
	}

	$property = $this->getPropertyById($fields['PROPERTY_ID']);
	$propertyType = $property['PROPERTY_TYPE'];
	if ($propertyType !== PropertyTable::TYPE_LIST)
	{
		$this->addError(new Error('Only list properties are supported'));
		return null;
	}

	$application = self::getApplication();
	$application->ResetException();

	$addResult = PropertyEnumerationTable::add($fields);
	if (!$addResult->isSuccess())
	{
		$this->addErrors($addResult->getErrors());
		return null;
	}

	return ['PRODUCT_PROPERTY_ENUM' => $this->get($addResult->getId())];
}

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