- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/lib/data/hsphpreadconnection.php
- Класс: BitrixMainDataHsphpReadConnection
- Вызов: HsphpReadConnection::getEntityByPrimary
public function getEntityByPrimary(BitrixMainORMEntity $entity, $primary, $select)
{
$this->connectInternal();
$table = $entity->getDBTableName();
$sqlConfiguration = $entity->getConnection()->getConfiguration();
$primary = (array) $primary;
if (count($primary) > 1)
{
throw new Exception('HSPHP Read Socket doesn't support multiple select');
}
$indexId = $this->resource->getIndexId($sqlConfiguration['database'], $table, '', join(',', (array) $select));
$this->resource->select($indexId, '=', $primary);
$response = $this->resource->readResponse();
//foreach
$result = array();
if (is_array($response))
{
foreach ($response as $row)
{
$newRow = array();
foreach ($row as $k => $v)
{
$newRow[$select[$k]] = $v;
}
$result[] = $newRow;
}
}
return $result;
}