Skip to content

Instantly share code, notes, and snippets.

@s2ar
Last active December 4, 2018 08:31
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save s2ar/a7e31d4e488f03ebff77 to your computer and use it in GitHub Desktop.
Save s2ar/a7e31d4e488f03ebff77 to your computer and use it in GitHub Desktop.
bitrix highloadblock getList
<?php
if(!CModule::IncludeModule('highloadblock')) die();
use Bitrix\Highloadblock as HL;
use Bitrix\Main\Entity;
$hlblock = HL\HighloadBlockTable::getById(5)->fetch();
$hlEntity = HL\HighloadBlockTable::compileEntity($hlblock);
$entDataClass = $hlEntity->getDataClass();
$sTableID = 'tbl_'.$hlblock['TABLE_NAME'];
$arFilter = array(); //задаете фильтр по вашим полям
$rsData = $entDataClass::getList(array(
"select" => array('*'), //выбираем все поля
"filter" => $arFilter,
"order" => array("UF_NAME"=>"ASC") // сортировка по полю UF_SORT, будет работать только, если вы завели такое поле в hl'блоке
));
$rsData = new CDBResult($rsData, $sTableID);
while($arRes = $rsData->Fetch()){
var_dump($arRes);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment