• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/item.php
  • Класс: Bitrix\Crm\Item
  • Вызов: Item::fill
public function fill(): void
{
	if ($this->isNew())
	{
		throw new InvalidOperationException('Cannot fill new item');
	}

	// if we set fm again from compatible data, new values will be duplicated
	$changedValues = $this->getCompatibleData(Values::CURRENT);

	$entityFieldsToFill = $this->getEntityFieldNames(FieldTypeMask::SCALAR|FieldTypeMask::USERTYPE);
	foreach ($this->getAllImplementations() as $implementation)
	{
		$fieldsFromImplementation = array_map(
			[$this, 'getEntityFieldNameByMap'],
			$implementation->getFieldNamesToFill(),
		);

		$entityFieldsToFill = array_merge($entityFieldsToFill, $fieldsFromImplementation);
	}

	if ($this->hasField(static::FIELD_NAME_OBSERVERS))
	{
		$entityFieldsToFill[] = $this->getEntityFieldNameByMap(static::FIELD_NAME_OBSERVERS);
	}
	if ($this->hasField(static::FIELD_NAME_PRODUCTS))
	{
		$entityFieldsToFill[] = $this->getEntityFieldNameByMap(static::FIELD_NAME_PRODUCTS);
	}

	$entityFieldsToFill = array_unique($entityFieldsToFill);

	$this->entityObject->fill($entityFieldsToFill);
	$this->fillExpressionFields($this->entityObject);

	$this->setFromCompatibleData($changedValues);
}