Last active
April 23, 2016 08:23
-
-
Save s2ar/e2745f91dd338b927642 to your computer and use it in GitHub Desktop.
bitrix.highload iblock element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Bitrix\Main\Application; | |
use Bitrix\Highloadblock\HighloadBlockTable; | |
use Bitrix\Main\Loader; | |
Loader::includeModule('highloadblock'); | |
Loader::includeModule('iblock'); | |
$hlBlockId = 2; | |
$hlblock = HighloadBlockTable::getById($hlBlockId)->fetch(); | |
/** @var \Bitrix\Main\Entity\Base $entity */ | |
$entity = HighloadBlockTable::compileEntity($hlblock); | |
/** @var \Bitrix\Main\Entity\DataManager $dataClass */ | |
$dataClass = $entity->getDataClass(); | |
Application::getConnection()->startTracker(); | |
$result = $dataClass::getList([ | |
'select' => array( | |
'UF_ELEMENT_ID', | |
'NAME' => 'ELEMENT.NAME', | |
'CODE' => 'ELEMENT.CODE', | |
'DETAIL_PICTURE' => 'ELEMENT.DETAIL_PICTURE', | |
), | |
'runtime' => array( | |
'ELEMENT' => array( | |
'data_type' => '\Bitrix\Iblock\ElementTable', | |
'reference' => array( | |
'=this.UF_ELEMENT_ID' => 'ref.ID' | |
), | |
'join_type' => 'inner' | |
), | |
), | |
'limit' => 10, | |
]); | |
// Можно смотреть сформированный запрос | |
echo '<pre>', $result->getTrackerQuery()->getSql(), '</pre>'; | |
while ($row = $result->fetch()) { | |
echo '<pre>';print_r($row);echo '</pre>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment