• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/orm/fields/relations/reference.php
  • Класс: BitrixMainORMFieldsRelationsReference
  • Вызов: Reference::getElementals
public function getElementals()
{
	if (!($this->reference instanceof Filter))
	{
		return false;
	}

	$elemental = [];

	foreach ($this->reference->getConditions() as $condition)
	{
		if (!($condition->getValue() instanceof ColumnExpression)
			|| $condition->getOperator() != '='
		)
		{
			continue;
		}

		// ok, we have a column filter. one should be `this.` and another one `ref.`
		$col1 = $condition->getColumn();
		$col2 = $condition->getValue()->getDefinition();

		$col1Flag = static::getElementalFlag($col1);
		$col2Flag = static::getElementalFlag($col2);

		if (($col1Flag + $col2Flag) == static::ELEMENTAL_BOTH)
		{
			// we have this and ref link
			$key = ($col1Flag == static::ELEMENTAL_THIS) ? $col1 : $col2;
			$value = ($col1Flag == static::ELEMENTAL_REF) ? $col1 : $col2;

			// cut .this and .ref from the start of definitions
			$key = substr($key, 5);
			$value = substr($value, 4);

			$elemental[$key] = $value;
		}
	}

	return $elemental;
}