I
I
Ivan Anikin2021-09-13 12:04:58
1C-Bitrix
Ivan Anikin, 2021-09-13 12:04:58

Why doesn't CIBlockElement::getList return IBLOCK_SECTION?

I make a request to the API to get the elements of the infoblock (well, in this particular example).

\Bitrix\Main\Loader::includeModule("iblock");
$rItems = \CIBlockElement::getList(array("SORT" => "ASC"),
    array(
        'ID' => intval($elId),
        'IBLOCK_ID' => intval($iblockId),
    ));
print_r($rItems->Fetch());

I expect to see in the array:
IBLOCK_SECTION_ID where the main section will be shown (it comes)
and IBLOCK_SECTION where the array is the ID of the sections to which the element is tied. But this array does not exist.

Why is this array not coming?

In what cases does this IBLOCK_SECTION field come at all ? Indeed, in the documentation it is https://dev.1c-bitrix.ru/api_help/iblock/fields.ph... I thought that this was due to the flag (Allow selection of the main section for binding.) in the infoblock settings, but trying a similar selecting another infoblock for an element that does not have this option, I get a similar result.

How to get a list of all sections to which this element is tied?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Anikin, 2021-09-13
@randomizex

Why is this array not coming?

As I understood from what I saw in the CIBlockElement class itself, the IBLOCK_SECTION field and should not come to getList, there is no logic for its formation. It is only in the Update of this class and serves to be able to link an element to several sections + specify the Main section IBLOCK_SECTION_ID
In what cases does this IBLOCK_SECTION field come at all? It's in the documentation...

It seems to never be given to the API. Serves only for the needs of CIBlockElement::Update
How to get a list of all sections to which this element is tied?

Well, here you have to use CIBlockElement:: GetElementGroups

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question