• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/controller/propertyvalue.php
  • Класс: BitrixSaleControllerPropertyValue
  • Вызов: PropertyValue::getPrimaryAutoWiredParameter
public function getPrimaryAutoWiredParameter()
{
	return new ExactParameter(
		SalePropertyValue::class,
		'propertyValue',
		function($className, $id) {
			$registry = SaleRegistry::getInstance(SaleRegistry::REGISTRY_TYPE_ORDER);

			/** @var SaleProperty $propertyValueClass */
			$propertyValueClass = $registry->getPropertyValueClassName();

			$r = $propertyValueClass::getList([
				'select'=>['ORDER_ID'],
				'filter'=>['ID'=>$id]
			]);

			if($row = $r->fetch())
			{
				/** @var SaleOrder $orderClass */
				$orderClass = $registry->getOrderClassName();

				$propertyValue = $orderClass::load($row['ORDER_ID'])
					->getPropertyCollection()
					->getItemById($id);
				if ($propertyValue)
				{
					return $propertyValue;
				}
			}
			else
			{
				$this->addError(new Error('property value is not exists', 201040400001));
			}
			return null;
		}
	);
}