• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/storedocumenttable.php
  • Класс: BitrixCatalogStoreDocumentTable
  • Вызов: StoreDocumentTable::withProductList
static function withProductList(MainORMQueryQuery $query, array $productIds)
{
	MainTypeCollection::normalizeArrayValuesByInt($productIds);
	if (empty($productIds))
	{
		return;
	}

	$tableName = StoreDocumentElementTable::getTableName();
	$whereExpression = '(ELEMENT_ID IN (' . implode(',', $productIds) . '))';
	$query->whereExpr("
		(
			CASE WHEN EXISTS (
				SELECT ID
				FROM {$tableName}
				WHERE DOC_ID = %s
				AND {$whereExpression}
			)
			THEN 1
			ELSE 0
			END
		) = 1
	", ['ID']);
}