• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/item/fieldimplementation/binding.php
  • Класс: Bitrix\Crm\Item\FieldImplementation\Binding
  • Вызов: Binding::getValue
private function getValue(string $commonFieldName, int $valuesType)
{
	if ($this->fieldNameMap->isSingleIdFilled() && $commonFieldName === $this->fieldNameMap->getSingleId())
	{
		if ($valuesType === Values::ACTUAL)
		{
			return $this->entityObject->remindActual($this->fieldNameMap->getSingleId());
		}

		return $this->entityObject->get($this->fieldNameMap->getSingleId());
	}

	if ($valuesType === Values::ACTUAL)
	{
		$bindingsCollection = $this->getActualBindingsCollection();
	}
	else
	{
		$bindingsCollection = $this->getBindingsCollection();
	}

	if (!$bindingsCollection)
	{
		return [];
	}

	$bindings = $this->bindingsCollectionToArray($bindingsCollection);

	if ($this->fieldNameMap->isMultipleIdsFilled() && $commonFieldName === $this->fieldNameMap->getMultipleIds())
	{
		return EntityBinding::prepareEntityIDs($this->boundEntityTypeId, $bindings);
	}
	if ($commonFieldName === $this->fieldNameMap->getBindings())
	{
		return $bindings;
	}
	if ($this->fieldNameMap->isBoundEntitiesFilled() && $commonFieldName === $this->fieldNameMap->getBoundEntities())
	{
		return $this->getBoundEntities($bindings);
	}

	throw new ArgumentOutOfRangeException('commonFieldName', $this->getHandledFieldNames());
}