• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/entitypropertyvaluecollection.php
  • Класс: BitrixSaleEntityPropertyValueCollection
  • Вызов: EntityPropertyValueCollection::save
public function save()
{
	$result = new Result();

	if (!$this->isChanged())
	{
		return $result;
	}

	$itemsFromDb = $this->getOriginalItemsValues();
	foreach ($itemsFromDb as $k => $v)
	{
		if ($this->getItemById($k))
		{
			continue;
		}

		$this->callEventOnBeforeSalePropertyValueDeleted($v);

		$r = static::delete($v);
		if (!$r->isSuccess())
		{
			$result->addErrors($r->getErrors());
		}

		$this->callEventOnSalePropertyValueDeleted($v);
	}

	/** @var PropertyValue $property */
	foreach ($this->collection as $property)
	{
		$r = $property->save();
		if (!$r->isSuccess())
		{
			$result->addErrors($r->getErrors());
		}
	}

	return $result;
}