R
R
ragnar_ok2019-08-27 22:54:19
1C-Bitrix
ragnar_ok, 2019-08-27 22:54:19

How to avoid calling HighloadBlockTable::compileEntity again?

Created two HL tables and thought I connected them (one-to-many) with the "Binding to highload-block elements" property. Contrary to expectations, the field turned out to be a string . Contains id : How to avoid calling again to fetch a property from another table in one query? That is, instead of a string with an id , you need to immediately get the elements from the associated table.
'UF_PROPERTY' => string(1) "1" // id
HighloadBlockTable::compileEntity

use Bitrix\Highloadblock;

    $entity = Highloadblock\HighloadBlockTable::compileEntity('Inversed');
    $dataClass = $entity->getDataClass();
    
    $result = $dataClass::getList();
    
    while ($dataArray = $result->fetch()) {
      $idArray[] = $dataArray['UF_PROPERTY']['ID'];
    }
    
    $entity = Highloadblock\HighloadBlockTable::compileEntity('Mapped');
    $dataClass = $entity->getDataClass();
    
    $result = $dataClass::getList([,
      'filter' => ['ID' => $idArray]
    ]);

//...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question