V
V
Vladimir Golub2018-05-12 18:17:17
1C-Bitrix
Vladimir Golub, 2018-05-12 18:17:17

How to output related highload blocks?

There is a highload block, one of the fields has the type "Binding to elements of highload blocks".
I'm displaying a list of properties using getList, but the output of the binding field is just id: 1, 2 3 ...

use Bitrix\Highloadblock\HighloadBlockTable as HLBT;
const MY_HL_BLOCK_ID = 91;
CModule::IncludeModule('highloadblock');

function GetEntityDataClass($HlBlockId) {
    if (empty($HlBlockId) || $HlBlockId < 1)
    {
        return false;
    }
    $hlblock = HLBT::getById($HlBlockId)->fetch();
    $entity = HLBT::compileEntity($hlblock);
    $entity_data_class = $entity->getDataClass();
    return $entity_data_class;
}

$entity_data_class = GetEntityDataClass(MY_HL_BLOCK_ID);
$rsData = $entity_data_class::getList(array(
    'select' => array('*')
));
while($el = $rsData->fetch()){
    print_r($el);
}

What should be written in the 'filter' property?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikolaev, 2018-05-12
@RazerVG

I already answered you on the Bitrix forum, but I will try to give an answer here.
The thing is that you do not understand how Bitrix stores and interprets it.
In fact, it does not process, but simply gets it from the database as is.
You can get related fields, but according to the rules of the ORM relation (and highloadblock is in fact ORM), if you have your case, you will return not 1 element with 3 nested structures, but 3 elements, each of which will contain 1 element.
Logic repeating the behavior of "Infoblocks 1.0".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question