Answer the question
In order to leave comments, you need to log in
What is the reason for this behavior, Fetch () is broken, what is the trouble?
Hi all!
It is not clear why Fetch() stopped working for the highload object.
$HLObject = $HLDataClass::getList(array(
"select" => array("*"),
"filter" => $arFilter
));
debug($HLObject); // выводит объект, как и было изначально
while ($arHLItem = $HLObject->Fetch()) {
debug($arHLItem); // пусто, пару дней назад было всё ок!
}
Answer the question
In order to leave comments, you need to log in
Good afternoon Author.
First: stop using print_r to display results, look at least through var_dump() (because Bitrix has objects referring to itself in one way or another and you can get into recursion).
Secondly: if you entered the while, then there is data, if you did not enter it, then there is no data.
Thirdly: from version 18, you can no longer fetch, but use foreach.
Try the following code:
\ob_start();
echo PHP_EOL."<pre>".PHP_EOL;
$highloadItems = $HLDataClass::getList(array(
"select" => ["*"],
"filter" => $arFilter
));
var_dump([
'filter' => $arFilter,
'rowsCount' => $highloadItems->getSelectedRowsCount()
]);
foreach ($highloadItems as $highloadItem)
{
var_dump( (array) $highloadItem );
}
\file_put_contents($_SERVER['DOCUMENT_ROOT'].'/uplod/testlog.log', \ob_get_clean(), FILE_APPEND);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question